|Daniel Ziltener 981144c743|
- About this egg
|113||Sets and Bags|
|158||Generators and Accumulators|
This library defines an SRFI-35 exception type
&redis-error that gets raised when Redis returns an error. The exception type has a single field called
redis-error-message containing the error message returned by Redis.
(define-condition-type &redis-error &error redis-error? (redis-error-message redis-error-message))
This egg currently uses a simple TCP connection without any "bells and whistles". The two ports are kept in a record of type
redis-connection in the fields
(redis-connect host port)
Connects to a (hopefully) Redis server at
rconn which must be a
(redis-run rconn command . args)
rconn to run
args. The args will be appended to the command, space-separated. Returns the parsed reply.
(redis-run-proc rconn proc . args)
proc with the output port of the
rconn as current output port, optionally with
args. Returns the parsed reply.
Supported Data Types
This Redis client supports all data types up to and including as specified in RESP3. Setting the protocol version with the
HELLO command, however, is the user's responsibility.
Simple strings start with
+ and are single-line.
+this is a simple string.
Simple errors are like simple strings, but they start with a
-ERR unknown command 'helloworld'
Blob strings are longer, potentially multi-line strings. Their sigil is
$, followed by an integer designating the string length.
Analogous to simple errors, blob errors are just blob strings. Receiving one with this Redis library will raise an error.
This is exactly like the Blob string type, but the initial byte is = instead of $. Moreover the first three bytes provide information about the format of the following string, which can be txt for plain text, or mkd for markdown. This library treats verbatim strings exactly like blob strings and won't split off the format info.
=15 txt:Some string
Integers are sent to the client prefixed with
Doubles are prefixed with
,. The data type also allows
inf for positive and
-inf for negative infinity.
Bignums are prefixed with
True and false values are represented as
#f, just like in Scheme.
The null type is encoded simply as
_, and results in
Arrays are marked with
* followed by the number of entries, and get returned as srfi-133 vectors.
*3 :1 :2 :3
Maps are represented exactly as arrays, but instead of using the
* byte, the encoded value starts with a
% byte. Moreover the number of following elements must be even. Maps represent a sequence of field-value items, basically what we could call a dictionary data structure, or in other terms, an hash. They get returned as srfi-69 hash tables.
%2 +first :1 +second :2
Sets are exactly like the Array type, but the first byte is
~ instead of
*. They get returned as srfi-113 sets.
Additionally, there is a parameter defined,
redis-set-comparator, that specifies the default comparator to be used for sets. It defaults to `(make-default-comparator)`.
~4 +orange +apple #t #f
The attribute type is exactly like the Map type, but instead of the
% first byte, the
| byte is used. Attributes describe a dictionary exactly like the Map type, however the client should not consider such a dictionary part of the reply, but just auxiliary data that is used in order to augment the reply.
This library returns two values in this case, the first value being the actual data reply from redis, the second one being the attributes.
About this egg
The source is available at https://gitea.lyrion.ch/Chicken/redis.git.
Copyright (C) 2022 Daniel Ziltener All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.