delphiredisclient - Redis client for Delphi
Delphi Redis Client版本2(此分支)与Delphi 10.1 Berlin兼容,更好。警告!如果您使用较旧的Delphi版本,则必须使用适用于Delphi 10 Seattle,XE8,XE7,XE6和XE5的Delphi Redis Client版本1(也适用于旧版本)。
Delphi REDIS客户端从第一个版本(或左右)开始在移动设备上运行,自从Delphi 10.2东京它也在Linux上工作(测试Ubuntu 16.x LTS)。
Delphi Redis Client能够发送所有Redis命令并使用内部解析器读取响应。此外,许多流行的命令具有专门的专用方法,这简化了利用率。
这是用于连接,发送命令和管理Redis服务器的Redis客户端界面。许多方法都是1-1映射到具有相同名称的Redis命令(例如,SET是Redis SET命令的映射)。计划实现某种集成设计模式的高级方法(例如,推送JSONObject,弹出流等)。
https://github.com/danieleteti/delphiredisclient
IRedisClient = interface
['{566C20FF-7D9F-4DAC-9B0E-A8AA7D29B0B4}']
function &SET(const AKey, AValue: string): boolean; overload;
function &SET(const AKey, AValue: TBytes): boolean; overload;
function &SET(const AKey: string; AValue: TBytes): boolean; overload;
function &SET(const AKey: string; AValue: TBytes; ASecsExpire: UInt64): boolean; overload;
function &SET(const AKey: string; AValue: string; ASecsExpire: UInt64): boolean; overload;
function SETNX(const AKey, AValue: string): boolean; overload;
function SETNX(const AKey, AValue: TBytes): boolean; overload;
function GET(const AKey: string; out AValue: string): boolean; overload;
function GET(const AKey: TBytes; out AValue: TBytes): boolean; overload;
function GET(const AKey: string; out AValue: TBytes): boolean; overload;
function DEL(const AKeys: array of string): Integer;
function TTL(const AKey: string): Integer;
function EXISTS(const AKey: string): boolean;
function MSET(const AKeysValues: array of string): boolean;
function KEYS(const AKeyPattern: string): TArray<string>;
function INCR(const AKey: string): NativeInt;
function DECR(const AKey: string): NativeInt;
function EXPIRE(const AKey: string; AExpireInSecond: UInt32): boolean;
// strings functions
function APPEND(const AKey, AValue: TBytes): UInt64; overload;
function APPEND(const AKey, AValue: string): UInt64; overload;
function STRLEN(const AKey: string): UInt64;
function GETRANGE(const AKey: string; const AStart, AEnd: NativeInt): string;
function SETRANGE(const AKey: string; const AOffset: NativeInt; const AValue: string)
: NativeInt;
// hash
function HSET(const AKey, aField: string; AValue: string): Integer; overload;
procedure HMSET(const AKey: string; aFields: TArray<string>; AValues: TArray<string>);
function HMGET(const AKey: string; aFields: TArray<string>): TArray<string>;
function HSET(const AKey, aField: string; AValue: TBytes): Integer; overload;
function HGET(const AKey, aField: string; out AValue: TBytes): boolean; overload;
function HGET(const AKey, aField: string; out AValue: string): boolean; overload;
function HDEL(const AKey: string; aFields: TArray<string>): Integer;
// lists
function RPUSH(const AListKey: string; AValues: array of string): Integer;
function RPUSHX(const AListKey: string; AValues: array of string): Integer;
function RPOP(const AListKey: string; var Value: string): boolean;
function LPUSH(const AListKey: string; AValues: array of string): Integer;
function LPUSHX(const AListKey: string; AValues: array of string): Integer;
function LPOP(const AListKey: string; out Value: string): boolean;
function LLEN(const AListKey: string): Integer;
procedure LTRIM(const AListKey: string; const AIndexStart, AIndexStop: Integer);
function LRANGE(const AListKey: string; IndexStart, IndexStop: Integer)
: TArray<string>;
function RPOPLPUSH(const ARightListKey, ALeftListKey: string;
var APoppedAndPushedElement: string): boolean; overload;
function BRPOPLPUSH(const ARightListKey, ALeftListKey: string;
var APoppedAndPushedElement: string; ATimeout: Int32): boolean; overload;
function BLPOP(const AKeys: array of string; const ATimeout: Int32;
out Value: TArray<string>): boolean;
function BRPOP(const AKeys: array of string; const ATimeout: Int32;
out Value: TArray<string>): boolean;
function LREM(const AListKey: string; const ACount: Integer;
const AValue: string): Integer;
// sets
function SADD(const AKey, AValue: TBytes): Integer; overload;
function SADD(const AKey, AValue: string): Integer; overload;
function SREM(const AKey, AValue: TBytes): Integer; overload;
function SREM(const AKey, AValue: string): Integer; overload;
function SMEMBERS(const AKey: string): TArray<string>;
function SCARD(const AKey: string): Integer;
// ordered sets
function ZADD(const AKey: string; const AScore: Int64; const AMember: string): Integer;
function ZREM(const AKey: string; const AMember: string): Integer;
function ZCARD(const AKey: string): Integer;
function ZCOUNT(const AKey: string; const AMin, AMax: Int64): Integer;
function ZRANK(const AKey: string; const AMember: string; out ARank: Int64): boolean;
function ZRANGE(const AKey: string; const AStart, AStop: Int64): TArray<string>;
function ZRANGEWithScore(const AKey: string; const AStart, AStop: Int64): TArray<string>;
function ZINCRBY(const AKey: string; const AIncrement: Int64; const AMember: string): string;
// lua scripts
function EVAL(const AScript: string; AKeys: array of string; AValues: array of string): Integer;
// system
procedure FLUSHDB;
procedure SELECT(const ADBIndex: Integer);
procedure AUTH(const aPassword: string);
// raw execute