Delphi Redis Client can send all Redis commands and read the response using an internal parser. Moreover, many popular commands have specialized dedicated methods that simplify utilization.
This is the Redis Client interface used to connect, send commands, and manage the Redis server. Many methods are 1-1 mapping to the Redis command with the same name (eg. SET is a map to the Redis SET command). High-level methods implementing some integration design pattern are planned (e.g. Push a JSONObject, Pop a Stream, and so on).
Delphi Redis Client is not tied to a specific TCP/IP library. Currently, it uses INDY but you can implement the IRedisNetLibAdapter and wrap whatever library you like.
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 29 30 31 32 33 34 35 36 37 38 39 40 41 |
program CmdsSample1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, Redis.Commons, // Interfaces and types Redis.Client, // The client itself Redis.NetLib.INDY, // The tcp library used Redis.Values; // nullable types for redis commands var lRedis: IRedisClient; lValue: TRedisString; begin try lRedis := TRedisClient.Create; lRedis.Connect; lRedis.&SET('firstname', 'Daniele'); lValue := lRedis.GET('firstname'); if not lValue.IsNull then WriteLn('KEY FOUND! key "firstname" => ', lValue.Value); WriteLn('DEL firstname'); lRedis.DEL(['firstname']); // remove the key lValue := lRedis.GET('firstname'); if lValue.IsNull then WriteLn('Key "firstname" doesn''t exist (it''s correct!)') else WriteLn(lValue.Value); // never printed except on E: Exception do WriteLn(E.ClassName, ': ', E.Message); end; readln; //just to keep the command prompt open end. |
Head over and check out the Redis Client for Delphi!
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition
I also know an alternative Redis Client. Even it’s a paid version, for me it has more comfortable interface and supports more functions:
https://pybridge.net/product/pbredisclient/