Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (47 sloc) 2.41 KB
[[tags: egg db]]
[[toc:]]
== redis
This page is maintained in the package's
[[https://github.com/abarbu/redis-chicken |github repository]].
Fast bindings to redis using hiredis. Note that you will need to fetch
the git submodules in this package. These bindings provide only the
synchornous API and at the moment do not provide timeouts.
<procedure>(redis-connect hostname port)</procedure>
Connect to a redis host, will produce an error if the connection
fails. Returns an opaque pointer to the redis context.
<procedure>(redis-command context string)</procedure>
Send the string as a command to redis and parse the reply. Arrays are
converted into lists. Due to a bug in hiredis if your command has a
string argument which contains whitespace you need to use
''redis-command*'' instead as it is impossible to correctly escape
whitespace characters. If you want to pass in binary data you should
also look at ''redis-command*'' instead.
<procedure>(redis-command* context command . arguments)</procedure>
Like ''redis-command'' but separately specifies the command and each
of its arguments. When you have a string argument which contains
whitespace you must use this function instead of ''redis-command''
because of a bug in hiredis.
=== Example
<enscript hilight="scheme">
(redis-command (redis-connect "127.0.0.1" 6379) "keys *")
</enscript>
This will produce a list of strings, the keys in the redis database.
<enscript hilight="scheme">
(begin (redis-command* (redis-connect "127.0.0.1" 6379) "hset" "a" "b" "x y z")
(redis-command* (redis-connect "127.0.0.1" 6379) "hget" "a" "b"))
</enscript>
Set key ''b'' in hash table ''a'' to a string which may contain
whitespace and retrieve that string.
=== License
Copyright 2012-2013 Andrei Barbu. All rights reserved.
Contact Andrei Barbu at andrei@0xab.com.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see http://www.gnu.org/licenses.