![Redis Client Library For Delphi | Embarcadero RAD Studio Delphi C++Builder Blogs redis client library for delphi](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/12/Redis-Client-Library-For-Delphi-2344791.png?resize=1140%2C675&ssl=1)
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!
![redisclient6652503 | Embarcadero RAD Studio Delphi C++Builder Blogs redisclient 6652503](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2021/01/redisclient-6652503.jpg?resize=750%2C515&ssl=1)
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition