source: project/wiki/eggref/4/redis @ 29422

Last change on this file since 29422 was 29422, checked in by anonymous, 7 years ago

redis 2.0

File size: 2.4 KB
Line 
1[[tags: egg db]]
2[[toc:]]
3
4== redis
5
6This page is maintained in the package's
7[[https://github.com/abarbu/redis-chicken |github repository]].
8
9Fast bindings to redis using hiredis. Note that you will need to fetch
10the git submodules in this package. These bindings provide only the
11synchornous API and at the moment do not provide timeouts.
12
13<procedure>(redis-connect hostname port)</procedure>
14
15Connect to a redis host, will produce an error if the connection
16fails. Returns an opaque pointer to the redis context.
17
18<procedure>(redis-command context string)</procedure>
19
20Send the string as a command to redis and parse the reply. Arrays are
21converted into lists. Due to a bug in hiredis if your command has a
22string argument which contains whitespace you need to use
23''redis-command*'' instead as it is impossible to correctly escape
24whitespace characters. If you want to pass in binary data you should
25also look at ''redis-command*'' instead.
26
27<procedure>(redis-command* context command . arguments)</procedure>
28
29Like ''redis-command'' but separately specifies the command and each
30of its arguments. When you have a string argument which contains
31whitespace you must use this function instead of ''redis-command''
32because of a bug in hiredis.
33
34=== Example
35<enscript hilight="scheme">
36   (redis-command (redis-connect "127.0.0.1" 6379) "keys *")
37</enscript>
38
39This will produce a list of strings, the keys in the redis database.
40
41<enscript hilight="scheme">
42   (begin (redis-command* (redis-connect "127.0.0.1" 6379) "hset" "a" "b" "x y z")
43          (redis-command* (redis-connect "127.0.0.1" 6379) "hget" "a" "b"))
44</enscript>
45
46Set key ''b'' in hash table ''a'' to a string which may contain
47whitespace and retrieve that string.
48
49=== License
50
51Copyright 2012-2013 Andrei Barbu. All rights reserved.
52
53Contact Andrei Barbu at andrei@0xab.com.
54
55This program is free software: you can redistribute it and/or modify
56it under the terms of the GNU Lesser General Public License as published by
57the Free Software Foundation, either version 3 of the License, or
58(at your option) any later version.
59This program is distributed in the hope that it will be useful,
60but WITHOUT ANY WARRANTY; without even the implied warranty of
61MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
62GNU Lesser General Public License for more details.
63You should have received a copy of the GNU Lesser General Public License
64along with this program.  If not, see http://www.gnu.org/licenses.
Note: See TracBrowser for help on using the repository browser.