Component for handling full Redis database API with a native-like command syntax.
Probably you already heard of Redis. If not, we strongly recommend to get in touch with this wonderful NoSQL database either on Wikipedia, or on the developer website.
Now you know, what is Redis. Maybe you even heard, that a huge amount of famous developers and companies are using this database. Redis can run almost on any OS. Redis clients are developed for mostly all popular programming languages. But until recently Delphi was undeservingly deprived. No one has offered a library or components for handling full Redis API. We are happy to announce that our company is offering our clients such a component.
Working with Redis in Delphi became so simple, that our component almost doesn’t require a special documentation. The whole documentation is in fact a rewritten Redis native documentation with adjusted command syntax.
- TPBRedisClient.AUTH
- TPBRedisClient.GETSET
- TPBRedisClient.INCRBYFLOAT
- TPBRedisClient.CLUSTER_ADDSLOTS
- …
Command | Redis | PBRedisClient | IRedisClient | |
---|---|---|---|---|
Total | 227 | 235 | 64 | |
1 | CLUSTER ADDSLOTS | |||
2 | CLUSTER COUNT-FAILURE-REPORTS | |||
3 | CLUSTER COUNTKEYSINSLOT | |||
4 | CLUSTER DELSLOTS | |||
5 | CLUSTER FAILOVER | |||
6 | CLUSTER FORGET | |||
7 | CLUSTER GETKEYSINSLOT | |||
8 | CLUSTER INFO | |||
9 | CLUSTER KEYSLOT | |||
10 | CLUSTER MEET | |||
11 | CLUSTER NODES | |||
12 | CLUSTER REPLICATE | |||
13 | CLUSTER RESET | |||
14 | CLUSTER SAVECONFIG | |||
15 | CLUSTER SET-CONFIG-EPOCH | |||
16 | CLUSTER SETSLOT | |||
17 | CLUSTER SLAVES | |||
18 | CLUSTER REPLICAS | |||
19 | CLUSTER SLOTS | |||
20 | READONLY | |||
21 | READWRITE | |||
22 | AUTH | |||
23 | ECHO | |||
24 | PING | |||
25 | QUIT | |||
26 | SELECT | |||
27 | SelectedDB | |||
28 | SWAPDB | |||
29 | SaveDB | |||
30 | LoadDB | |||
31 | NumberOfDatabases | |||
32 | GEOADD | |||
33 | GEOHASH | |||
34 | GEOPOS | |||
35 | GEODIST | |||
36 | GEORADIUS | |||
37 | GEORADIUSBYMEMBER | |||
38 | HDEL | |||
39 | HEXISTS | |||
40 | HGET | |||
41 | HGETALL | |||
42 | HINCRBY | |||
43 | HINCRBYFLOAT | |||
44 | HKEYS | |||
45 | HLEN | |||
46 | HMGET | |||
47 | HMSET | |||
48 | HSET | |||
49 | HSETNX | |||
50 | HSTRLEN | |||
51 | HVALS | |||
52 | HSCAN | |||
53 | PFADD | |||
54 | PFCOUNT | |||
55 | PFMERGE | |||
56 | DEL | |||
57 | DUMP | |||
58 | SaveDump | |||
59 | RestoreDump | |||
60 | EXISTS | |||
61 | EXPIRE | |||
62 | EXPIREAT | |||
63 | KEYS | |||
64 | MIGRATE | |||
65 | MOVE | |||
66 | OBJECT | |||
67 | PERSIST | |||
68 | PEXPIRE | |||
69 | PEXPIREAT | |||
70 | PTTL | |||
71 | RANDOMKEY | |||
72 | RENAME | |||
73 | RENAMENX | |||
74 | RESTORE | |||
75 | SORT | |||
76 | TOUCH | |||
77 | TTL | |||
78 | TYPE | |||
79 | UNLINK | |||
80 | WAIT | |||
81 | SCAN | |||
82 | BLPOP | |||
83 | BRPOP | |||
84 | BRPOPLPUSH | |||
85 | LINDEX | |||
86 | LINSERT | |||
87 | LLEN | |||
88 | LPOP | |||
89 | LPUSH | |||
90 | LPUSHX | |||
91 | LRANGE | |||
92 | LREM | |||
93 | LSET | |||
94 | LTRIM | |||
95 | RPOP | |||
96 | RPOPLPUSH | |||
97 | RPUSH | |||
98 | RPUSHX | |||
99 | PSUBSCRIBE | |||
100 | PUBSUB | |||
101 | PUBLISH | |||
102 | PUNSUBSCRIBE | |||
103 | SUBSCRIBE | |||
104 | UNSUBSCRIBE | |||
105 | Channels | |||
106 | EVAL | |||
107 | EVALSHA | |||
108 | SCRIPT DEBUG | |||
109 | SCRIPT EXISTS | |||
110 | SCRIPT FLUSH | |||
111 | SCRIPT KILL | |||
112 | SCRIPT LOAD | |||
113 | BGREWRITEAOF | |||
114 | BGSAVE | |||
115 | CLIENT ID | |||
116 | CLIENT KILL | |||
117 | CLIENT LIST | |||
118 | CLIENT GETNAME | |||
119 | CLIENT PAUSE | |||
120 | CLIENT REPLY | |||
121 | CLIENT SETNAME | |||
122 | CLIENT UNBLOCK | |||
123 | COMMAND | |||
124 | COMMAND COUNT | |||
125 | COMMAND GETKEYS | |||
126 | COMMAND INFO | |||
127 | CONFIG GET | |||
128 | CONFIG REWRITE | |||
129 | CONFIG SET | |||
130 | CONFIG RESETSTAT | |||
131 | DBSIZE | |||
132 | DEBUG OBJECT | |||
133 | DEBUG SEGFAULT | |||
134 | FLUSHALL | |||
135 | FLUSHDB | |||
136 | INFO | |||
137 | LASTSAVE | |||
138 | MEMORY DOCTOR | |||
139 | MEMORY HELP | |||
140 | MEMORY MALLOC-STATS | |||
141 | MEMORY PURGE | |||
142 | MEMORY STATS | |||
143 | MEMORY USAGE | |||
144 | MONITOR | |||
145 | StopMonitor | |||
146 | ROLE | |||
147 | SAVE | |||
148 | SHUTDOWN | |||
149 | SLAVEOF | |||
150 | REPLICAOF | |||
151 | SLOWLOG | |||
152 | SYNC | |||
153 | TIME | |||
154 | SADD | |||
155 | SCARD | |||
156 | SDIFF | |||
157 | SDIFFSTORE | |||
158 | SINTER | |||
159 | SINTERSTORE | |||
160 | SISMEMBER | |||
161 | SMEMBERS | |||
162 | SMOVE | |||
163 | SPOP | |||
164 | SRANDMEMBER | |||
165 | SREM | |||
166 | SUNION | |||
167 | SUNIONESTORE | |||
168 | SSCAN | |||
169 | BZPOPMIN | |||
170 | BZPOPMAX | |||
171 | ZADD | |||
172 | ZCARD | |||
173 | ZCOUNT | |||
174 | ZINCRBY | |||
175 | ZINTERSTORE | |||
176 | ZLEXCOUNT | |||
177 | ZPOPMAX | |||
178 | ZPOPMIN | |||
179 | ZRANGE | |||
180 | ZRENGEBYLEX | |||
181 | ZREVRANGEBYLEX | |||
182 | ZRANGEBYSCORE | |||
183 | ZRANK | |||
184 | ZREM | |||
185 | ZREMRANGEBYLEX | |||
186 | ZREMRANGEBYRANK | |||
187 | ZREMRANGEBYSCORE | |||
188 | ZREVRANGE | |||
189 | ZREVRANGEBYSCORE | |||
190 | ZREVRANK | |||
191 | ZSCORE | |||
192 | ZUNIONSTORE | |||
193 | ZSCAN | |||
194 | XINFO | |||
195 | XADD | |||
196 | XTRIM | |||
197 | XDEL | |||
198 | XRANGE | |||
199 | XREVRANGE | |||
200 | XLEN | |||
201 | XREAD | |||
202 | XGROUP | |||
203 | XREADGROUP | |||
204 | XACK | |||
205 | XCLAIM | |||
206 | XPENDING | |||
207 | APPEND | |||
208 | BITCOUNT | |||
209 | BITFIELD | |||
210 | BITOP | |||
211 | BITPOS | |||
212 | DECR | |||
213 | DECRBY | |||
214 | GET | |||
215 | GETBIT | |||
216 | GETRANGE | |||
217 | GETSET | |||
218 | INCR | |||
219 | INCRBY | |||
220 | INCRBYFLOAT | |||
221 | MGET | |||
222 | MSET | |||
223 | MSETNX | |||
224 | PSETEX | |||
225 | SET | |||
226 | SETBIT | |||
227 | SETEX | |||
228 | SETNX | |||
229 | SETRANGE | |||
230 | STRLEN | |||
231 | DISCARD | |||
232 | EXEC | |||
233 | MULTI | |||
234 | UNWATCH | |||
235 | WATCH |
If new commands will be released, you will still be able to access them with a RUN command returning a JSON object:
1 2 3 4 5 |
function TPBRedisClient.Run(const commandname: string; Parameters: TStringArray): string; procedure TPBRedisClient.Run(var Result: TJSONObject; const commandname: string; Parameters: TStringArray); |
For instance, this 2 commands are equivalent:
1 2 3 | PBRedisClient1.HSET('key', 'field', 'value'); PBRedisClient1.Run('HSET', ['key', 'field', 'value']); |
Data type | Redis | PBRedisClient | IRedisClient |
---|---|---|---|
String [Array] | [] | [] | [] |
Byte [Array] | [] | [] | [] |
Word [Array] | [] | [] | [] |
Cardinal [Array] | [] | [] | [] |
Integer [Array] | [] | [] | [] |
Int64 [Array] | [] | [] | [] |
Single [Array] | [] | [] | [] |
Double [Array] | [] | [] | [] |
Extended [Array] | [] | [] | [] |
Prerequirements
- In order for this component to work you have to obtain, install and run the respective Redis software and its licenses. We do not provide any Redis software.
OS compatibility
7 SP2 x64 |
8 x64 |
8.1 x64 |
10 x64 |
11 x64 |
RAD Studio compatibility
Delphi |
---|
10 Seattle |
10.1 Berlin |
10.2 Tokyo |
10.3 Rio |
10.4 Sydney |
11 Alexandria |
1 user
3 users
5 users
10 users
Site license
Free components in a bundle
Buy a bundle now and enjoy all new component releases for free during the update period. |
Keep track of multiple versions
You will get access to all older versions and a detailed changelog. |
Free new features
Get all new component features for free during the free update period. |
Install once use forever
Our products are not time limited. |
Source code promise
In case our component will become obsolete and we no longer support it, we will provide you its source code. So you don’t have to worry about a replacement. |
References:
> QSG code example provided with the installer
> RedisClient native commands
After installation, a group PyBridge will appear in the Tool Palette of Delphi, where you can find the new component TPBRedisClient.
New component TPBRedisClient can be found in the Tool Palette under PyBridge group
Place TPBRedisClient onto the form and set up its main properties:
- AutoConnect – set to True for automatic connection to Redis
- RedisServer – setup host, password and port number to access Redis
Now PBClient for Redis is ready to be used. To demonstrate how it works, let’s create a text-chat application which can:
- do operations with database keys
- subscribe and publish messages to a channel
PBRedisClientDemo layout
ButtonClick event handler procedures of the ‘SET’, ‘GET’ and ‘INCR’ buttons:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
procedure TForm1.SETButtonClick(Sender: TObject); begin PBRedisClient1.&SET(Edit1.Text, Edit2.Text); Memo1.Lines.Add('SET ' + Edit1.Text + ' ' + Edit2.Text); end; procedure TForm1.GETButtonClick(Sender: TObject); var strval: String; intval: Integer; begin strval:= PBRedisClient1.GET(Edit1.Text); Memo1.Lines.Add('GET '+ Edit1.Text + '= ' + strval); end; procedure TForm1.INCRButtonClick(Sender: TObject); var n: Integer; strval: String; begin if not TryStrToInt(Edit2.Text, n) then begin Memo1.Lines.Add('It is not a digit!'); Edit2.Text:='123'; SETButtonClick(Sender); end; PBRedisClient1.INCR(Edit1.Text); GETButtonClick(Sender); end; |
ButtonClick event handler procedures of the ‘SUBSCRIBE’, ‘PUBLISH’ and ‘UNSUBSCRIBE’ buttons:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
procedure TForm1.SUBSCRIBEButtonClick(Sender: TObject); begin PBRedisClient1.SUBSCRIBE('ChannelDemo'); Memo1.Lines.Add('SUBSCRIBED to the ' + '"ChannelDemo"'); end; procedure TForm1.PUBLISHButtonClick(Sender: TObject); begin PBRedisClient1.PUBLISH('ChannelDemo', Edit3.Text); end; procedure TForm1.UNSUBSCRIBEButtonClick(Sender: TObject); begin PBRedisClient1.UNSUBSCRIBE; Memo1.Lines.Add('UNSUBSCRIBED from the ' + '"ChannelDemo"'); end; |
OnGetChannelMessage event will add a line to the Memo:
1 2 3 4 |
procedure TForm1.PBRedisSubscriber1GetMessage(const AChannel, AMessage: string); begin Memo1.Lines.Add(AChannel + ': ' + AMessage); end; |
Start several instances of the program, subscribe them to the same channel (in the trial version only the default “Channel Demo” is available). Now you can exchange messages and do operations with database keys.
This example demonstrates how easy it is to develop Delphi applications relying on Redis with the help of PBClient for Redis. Now you can also enjoy the full power of Redis in your applications!