-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfphiredis_test.pas
39 lines (29 loc) · 938 Bytes
/
fphiredis_test.pas
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
program fphiredis_test;
{$MODE OBJFPC}
{$LONGSTRINGS ON}
uses
utnhiredis;
var
context:PRedisContext;
reply:PRedisReply;
s:ansistring='zwei';
begin
context := fp_redisconnect('127.0.0.1', 6379);
if (context = nil ) or ( context^.err <> 0 ) then
begin
writeln('Error connecting to redis server : ', context^.errstr);
exit;
end;
reply := fp_redisCommand(context, 'SET A "plüs öne"', []);
writeln('Reply = ', reply^.str);
reply := fp_redisCommand(context, 'SET %s "%s"', [ansistring('B'), s]);
writeln('Reply = ', reply^.str);
reply := fp_redisCommand(context, 'SET C "%s"', [ansistring('das könnte ein test sein')]);
writeln('Reply = ', reply^.str);
reply := fp_redisCommand(context, 'GET A',[]);
writeln('A=', reply^.str);
reply := fp_redisCommand(context, 'GET B',[]);
writeln('B=', reply^.str);
reply := fp_redisCommand(context, 'GET C',[]);
writeln('C = ', reply^.str);
end.