The cl-ssdb Reference Manual

This is the cl-ssdb Reference Manual, version 0.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 04:28:50 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cl-ssdb

SSDB client for Common Lisp.

Author

Muyinliu Xing <>

License

MIT

Version

0.0.1

Dependencies
  • rutils (system).
  • cl-ppcre (system).
  • usocket (system).
  • flexi-streams (system).
  • parse-number (system).
  • babel (system).
Source

cl-ssdb.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 cl-ssdb/cl-ssdb.asd

Source

cl-ssdb.asd.

Parent Component

cl-ssdb (system).

ASDF Systems

cl-ssdb.


3.1.2 cl-ssdb/packages.lisp

Source

cl-ssdb.asd.

Parent Component

cl-ssdb (system).

Packages

cl-ssdb.


3.1.3 cl-ssdb/connection.lisp

Dependency

packages.lisp (file).

Source

cl-ssdb.asd.

Parent Component

cl-ssdb (system).

Public Interface
Internals

3.1.4 cl-ssdb/cl-ssdb.lisp

Dependency

connection.lisp (file).

Source

cl-ssdb.asd.

Parent Component

cl-ssdb (system).

Public Interface
Internals

3.1.5 cl-ssdb/commands.lisp

Dependency

cl-ssdb.lisp (file).

Source

cl-ssdb.asd.

Parent Component

cl-ssdb (system).

Public Interface
Internals

version (function).


4 Packages

Packages are listed by definition order.


4.1 cl-ssdb

Source

packages.lisp.

Nickname

ssdb

Use List
  • common-lisp.
  • org.mapcar.parse-number.
  • rtl.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *connection*

The current SSDB connection.

Package

cl-ssdb.

Source

connection.lisp.

Special Variable: *echo-p*

Whether the server-client communication should be echoed to the stream specified by *ECHO-STREAM*. The default is NIL, meaning no echoing.

Package

cl-ssdb.

Source

connection.lisp.

Special Variable: *echo-stream*

A stream to which the server-client communication will be echoed for debugging purposes. The default is *STANDARD-OUTPUT*.

Package

cl-ssdb.

Source

connection.lisp.


5.1.2 Macros

Macro: def-cmd (cmd (&rest args) reply-type docstring)

Define and export a function with the name <*CMD-REDIX*>-<CMD> for processing a SSDB command CMD. Here REPLY-TYPE is the expected reply format.

Package

cl-ssdb.

Source

cl-ssdb.lisp.

Macro: with-connection ((&key host port auth) &body body)

Evaluate BODY with the current connection bound to a new connection specified by the given HOST and PORT

Package

cl-ssdb.

Source

connection.lisp.

Macro: with-persistent-connection ((&key host port auth) &body body)

Execute BODY inside WITH-CONNECTION. But if connection is broken due to SSDB-CONNECTION-ERROR (a network error or timeout), transparently reopen it.

Package

cl-ssdb.

Source

connection.lisp.

Macro: with-pipelining (&body body)

Delay execution of EXPECT’s inside BODY to the end, so that all commands are first sent to the server and then their output is received and collected into a list. So commands return :PIPELINED instead of the expected results.

Package

cl-ssdb.

Source

cl-ssdb.lisp.

Macro: with-recursive-connection ((&key host port auth) &body body)

Execute BODY with *CONNECTION* bound to the default SSDB connection. If connection is already established, reuse it.

Package

cl-ssdb.

Source

connection.lisp.


5.1.3 Ordinary functions

Function: add_allow_ip (ip_rule)

Available since: 1.9.3

Add one allow ip rule.

Warning: After you have modify any allow/deny rule, you must modify both the configuration file! Or the rules will be reload from configuration file after you restart ssdb-server.

Parameters
rule - IP address filter rule, specify only the prefix, 127.0.1, 127.0, etc.

Return Value
Status reply.

Package

cl-ssdb.

Source

commands.lisp.

Function: add_deny_ip (ip_rule)

Available since: 1.9.3

Add one deny ip rule.

Warning: After you have modify any allow/deny rule, you must modify both the configuration file! Or the rules will be reload from configuration file after you restart ssdb-server.

Parameters
rule - IP address filter rule, specify only the prefix, 127.0.1, 127.0, etc.

Return Value
Status reply.

Package

cl-ssdb.

Source

commands.lisp.

Function: auth (pass)

Available since: 1.7.0.0

Authenticate the connection.

Warning: The password is sent in plain-text over the network!

Parameters
password - the password

Return Value
Status reply.

Package

cl-ssdb.

Source

commands.lisp.

Function: bitcount (key &optional start end)

Count the number of set bits (population counting) in a string. Like Redis’s bitcount.
Parameters

key -
start - Optional, inclusive, if start is negative, count from start’th character from the end of string. unit: bytes end - Optional, inclusive. unit: bytes

Return Value
The number of bits set to 1.

Package

cl-ssdb.

Source

commands.lisp.

Function: clear_binlog ()

Clear binlog, will get an "ok".
Note: It’s NOT a public command, but it works.

Package

cl-ssdb.

Source

commands.lisp.

Function: close-connection (conn)

Close the socket of CONN.

Package

cl-ssdb.

Source

connection.lisp.

Function: compact ()

Compress database, will get an "ok".
Note: It’s NOT a public command, but it works.

Package

cl-ssdb.

Source

commands.lisp.

Function: connect (&key host port auth)

Connect to SSDB server.

Package

cl-ssdb.

Source

connection.lisp.

Function: connected-p ()

Is there a current connection?

Package

cl-ssdb.

Source

connection.lisp.

Function: countbit (key &optional start size)

Count the number of set bits (population counting) in a string. Unlike bitcount, it take part of the string by start and size, not start and end. Parameters

key -
start - Optional, inclusive, if start is negative, count from start’th character from the end of string.
size - Optional, if size is negative, then that many characters will be omitted from the end of string.

Return Value
The number of bits set to 1.

Package

cl-ssdb.

Source

commands.lisp.

Function: dbsize ()

Return the approximate size of the database, in bytes. If compression is enabled, the size will be of the compressed data.

Return Value
Size in bytes.

Package

cl-ssdb.

Source

commands.lisp.

Function: del (key)

Delete specified key.
Parameters

key -

Return Value
Status reply. You can not determine whether the key exists or not by delete command.

Package

cl-ssdb.

Source

commands.lisp.

Function: del_allow_ip (ip_rule)

Available since: 1.9.3

Delete one allow ip rule.

Warning: After you have modify any allow/deny rule, you must modify both the configuration file! Or the rules will be reload from configuration file after you restart ssdb-server.

Parameters
rule - IP address filter rule, specify only the prefix, 127.0.1, 127.0, etc.

Return Value
Status reply.

Package

cl-ssdb.

Source

commands.lisp.

Function: del_deny_ip (ip_rule)

Available since: 1.9.3

Delete one deny ip rule.

Warning: After you have modify any allow/deny rule, you must modify both the configuration file! Or the rules will be reload from configuration file after you restart ssdb-server.

Parameters
rule - IP address filter rule, specify only the prefix, 127.0.1, 127.0, etc.

Return Value
Status reply.

Package

cl-ssdb.

Source

commands.lisp.

Function: disconnect ()

Disconnect from SSDB server.

Package

cl-ssdb.

Source

connection.lisp.

Function: exists (key)

Verify if the specified key exists. Parameters

key -

Return Value
If the key exists, return 1, otherwise return 0.

Package

cl-ssdb.

Source

commands.lisp.

Function: expire (key ttl)

Set the time left to live in seconds, only for keys of KV type.

Parameters
key -
ttl - number of seconds to live.

Return Value
If the key exists then ttl will be set/update, return 1, otherwise return 0.

Package

cl-ssdb.

Source

commands.lisp.

Function: flushdb (&optional data-type)

flushdb is NOT a standard command. But as ssdb-cli supported it as a client side command since 1.9.2, adding this command would be fine. It’s convenient for test.

Return Example:
10
("kv" . 1)
("hash" . 2)
("zset" . 3)
("list" . 4)

Package

cl-ssdb.

Source

commands.lisp.

Function: get (key)

Get the value related to the specified key.

Parameters
key -

Return Value
Value reply.

Return the value to the key, if the key does not exists, return not_found Status Code.

Package

cl-ssdb.

Source

commands.lisp.

Function: getbit (key offset)

Return a single bit out of a string. Parameters

key -
offset - bit offset.

Return Value
0 or 1.

Package

cl-ssdb.

Source

commands.lisp.

Function: getset (key value)

Sets a value and returns the previous entry at that key.
Parameters

key -
value -

Return Value
If the key already exists, the value related to that key is returned. Otherwise return not_found Status Code. The value is either added or updated.

Package

cl-ssdb.

Source

commands.lisp.

Function: hclear (name)

Delete all keys in a hashmap. Parameters

name - The name of the hashmap.

Return Value
The number of key deleted in that hashmap.

Package

cl-ssdb.

Source

commands.lisp.

Function: hdel (name key)

Delete specified key of a hashmap. To delete the whole hashmap, use hclear. Parameters

name - The name of the hashmap
key - The key of the key-value pair in the hashmap

Return Value
If the key exists, return 1, otherwise return 0.

Package

cl-ssdb.

Source

commands.lisp.

Function: hexists (name key)

Verify if the specified key exists in a hashmap. Parameters

name - The name of the hashmap
key -

Return Value
If the key exists, return 1, otherwise return 0.

Package

cl-ssdb.

Source

commands.lisp.

Function: hget (name key)

Get the value related to the specified key of a hashmap
Parameters

name - The name of the hashmap
key - The key of the key-value pair in the hashmap

Return Value
Value reply.
Return the value to the key, if the key does not exists, return not_found Status Code.

Package

cl-ssdb.

Source

commands.lisp.

Function: hgetall (name)

Returns the whole hash, as an array of strings indexed by strings. Parameters

name - The name of the hashmap

Return Value
Key-Value list.
The key-value list is return as: k1 v1 k2 v2 ...

Package

cl-ssdb.

Source

commands.lisp.

Function: hincr (name key &optional num)

Since 1.7.0.1, *incr methods return error if value cannot be converted to integer.
Increment the number stored at key in a hashmap by num. The num argument could be a negative integer. The old number is first converted to an integer before increment, assuming it was stored as literal integer. Parameters

name - the name of the hashmap
‘key -
num - Optional, must be a signed integer, default is 1

Return Value
The new value. If the old value cannot be converted to an integer, returns error Status Code.

Package

cl-ssdb.

Source

commands.lisp.

Function: hkeys (name key_start key_end limit)

List keys of a hashmap in range (key_start, key_end].
("", ""] means no range limit.
Parameters

name - The name of the hashmap
key_start - The lower bound(not included) of keys to be returned, empty string means -inf(no limit). key_end - The upper bound(inclusive) of keys to be returned, empty string means +inf(no limit). limit - Up to that many elements will be returned.

Return Value
Key list.
The key list is return as: k1 k2 ...

Package

cl-ssdb.

Source

commands.lisp.

Function: hlist (name_start name_end limit)

List hashmap names in range (name_start, name_end].
("", ""] means no range limit.
Refer to scan command for more information about how it work.
Parameters

name_start - The lower bound(not included) of names to be returned, empty string means -inf(no limit). name_end - The upper bound(inclusive) of names to be returned, empty string means +inf(no limit). limit - Up to that many elements will be returned.

Return Value
Key-Value list.
The key-value list is return as: k1 v1 k2 v2 ...

Package

cl-ssdb.

Source

commands.lisp.

Function: hrlist (name_start name_end limit)

Like hlist, but in reverse order.

Package

cl-ssdb.

Source

commands.lisp.

Function: hrscan (name key_start key_end limit)

Like hscan, but in reverse order.

Package

cl-ssdb.

Source

commands.lisp.

Function: hscan (name key_start key_end limit)

List key-value pairs of a hashmap with keys in range (key_start, key_end].
("", ""] means no range limit.
Refer to scan command for more information about how it work.
Parameters

name - The name of the hashmap
key_start - The lower bound(not included) of keys to be returned, empty string means -inf(no limit). key_end - The upper bound(inclusive) of keys to be returned, empty string means +inf(no limit). limit - Up to that many pairs will be returned.

Return Value
Key-Value list.
The key-value list is return as: k1 v1 k2 v2 ...

Package

cl-ssdb.

Source

commands.lisp.

Function: hset (name key value)

Set the string value in argument as value of the key of a hashmap. Parameters

name - The name of the hashmap
key - The key of the key-value pair in the hashmap
value - The value of the key-value pair in the hashmap

Return Value
Returns 1 if key is a new key in the hashmap and value is set, else returns 0.

Package

cl-ssdb.

Source

commands.lisp.

Function: hsize (name)

Return the number of key-value pairs in the hashmap. Parameters

name - The name of the hashmap

Return Value
Integer reply.

Package

cl-ssdb.

Source

commands.lisp.

Function: incr (key &optional num)

Since 1.7.0.1, *incr methods return error if value cannot be converted to integer.
Increment the number stored at key by num. The num argument could be a negative integer. The old number is first converted to an integer before increment, assuming it was stored as literal integer. Parameters

key -
num - Optional, must be a signed integer, default is 1

Return Value
The new value. If the old value cannot be converted to an integer, returns error Status Code.

Package

cl-ssdb.

Source

commands.lisp.

Function: info (&optional opt)

Return information about the server.

Parameters
opt - Optional, could be cmd, leveldb

Return Value
Key-Value list.

The key-value list is return as: k1 v1 k2 v2 ...

Package

cl-ssdb.

Source

commands.lisp.

Function: list_allow_ip ()

Available since: 1.9.3

List all allow ip rules.

Parameters
None.

Return Value
List reply.

Package

cl-ssdb.

Source

commands.lisp.

Function: list_deny_ip ()

Available since: 1.9.3

List all deny ip rules.

Parameters
None.

Return Value
List reply.

Package

cl-ssdb.

Source

commands.lisp.

Function: multi_del (&rest keys)

Delete specified multiple keys. Parameters

key1 -
...

Return Value
false on error, other values indicate OK.

Package

cl-ssdb.

Source

commands.lisp.

Function: multi_get (&rest keys)

Get the values related to the specified multiple keys
Parameters

key1 -
...

Return Value
Key-value list.
The keys not found will not be included in the reply, the key-value list is return as: k1 v1 k2 v2 ...

Package

cl-ssdb.

Source

commands.lisp.

Function: multi_hdel (name &rest keys)

Delete specified multiple keys in a hashmap. Parameters

name -
key1 -
...

Return Value
false on error, other values indicate OK.

Package

cl-ssdb.

Source

commands.lisp.

Function: multi_hget (name &rest keys)

Get the values related to the specified multiple keys of a hashmap.
Parameters

name -
key1 -
...

Return Value
Key-value list.
The keys not found will not be included in the reply, the key-value list is return as: k1 v1 k2 v2 ...

Package

cl-ssdb.

Source

commands.lisp.

Function: multi_hset (name &rest key-value-plist)

Set multiple key-value pairs(kvs) of a hashmap in one method call. Parameters

name -
key1 -
value1 -
...

Return Value
false on error, other values indicate OK.

Package

cl-ssdb.

Source

commands.lisp.

Function: multi_set (&rest key-value-plist)

Set multiple key-value pairs(kvs) in one method call. Parameters

key1 -
value1 -
...

Return Value
false on error, other values(count of keys) indicate OK.

Package

cl-ssdb.

Source

commands.lisp.

Function: multi_zdel (name &rest keys)

Delete specified multiple keys of a zset. Parameters

name -
key1 -
...

Return Value
false on error, other values indicate OK.

Package

cl-ssdb.

Source

commands.lisp.

Function: multi_zget (name &rest keys)

Get the values related to the specified multiple keys of a zset.
Parameters

name -
key1 -
...

Return Value
Key-value list.
The keys not found will not be included in the reply, the key-value list is return as: k1 v1 k2 v2 ...

Package

cl-ssdb.

Source

commands.lisp.

Function: multi_zset (name &rest key-score-plist)

Set multiple key-score pairs(kvs) of a zset in one method call. Parameters

name -
key1 -
score1 -
...

Return Value
false on error, other values indicate OK.

Package

cl-ssdb.

Source

commands.lisp.

Function: open-connection (conn)

Create a socket connection to the host and port of CONNECTION and set the socket of CONN to the associated socket.

Package

cl-ssdb.

Source

connection.lisp.

Function: ping ()

Ping server, will get an "ok", NOT a "pong". Note: It’s NOT a public command, but it works.

Package

cl-ssdb.

Source

commands.lisp.

Function: qback (name)

Returns the last element of a queue.
Parameters

name -

Return Value
false on error, null if queue empty, otherwise the item returned.

Package

cl-ssdb.

Source

commands.lisp.

Function: qclear (name)

Clear the queue. Parameters

name -

Return Value false on error.

Package

cl-ssdb.

Source

commands.lisp.

Function: qfront (name)

Returns the first element of a queue.
Parameters

name -

Return Value
false on error, null if queue empty, otherwise the item returned.

Package

cl-ssdb.

Source

commands.lisp.

Function: qget (name index)

Returns the element a the specified index(position). 0 the first element, 1 the second ... -1 the last element. Parameters

name -
index - negative intexes accepted.

Return Value
false on error, null if no element corresponds to this index, otherwise the item returned.

Package

cl-ssdb.

Source

commands.lisp.

Function: qlist (name_start name_end limit)

List list/queue names in range (name_start, name_end].
("", ""] means no range limit.
Refer to scan command for more information about how it work.

Parameters
name_start - The lower bound(not included) of names to be returned, empty string means -inf(no limit). name_end - The upper bound(inclusive) of names to be returned, empty string means +inf(no limit). limit - Up to that many elements will be returned.

Return Value
false on error, otherwise an array containing the names.

Package

cl-ssdb.

Source

commands.lisp.

Function: qpop (name size)

Alias of qpop_front

Package

cl-ssdb.

Source

commands.lisp.

Function: qpop_back (name &optional size)

Pop out one or more elements from the tail of a queue.
Parameters

name -
size - Optional, number of elements to pop, default is 1

Return Value
false on error. When size is not specified or less than 2, returns null if queue empty, otherwise the item removed. When size is specified and greater than or equal to 2, returns an array of elements removed.

Package

cl-ssdb.

Source

commands.lisp.

Function: qpop_front (name &optional size)

Pop out one or more elements from the head of a queue.
Parameters

name -
size - Optional, number of elements to pop, default is 1

Return Value
false on error. When size is not specified or less than 2, returns null if queue empty, otherwise the item removed. When size is specified and greater than or equal to 2, returns an array of elements removed.

Package

cl-ssdb.

Source

commands.lisp.

Function: qpush (name &rest items)

Alias of qpush_back

Package

cl-ssdb.

Source

commands.lisp.

Function: qpush_back (name &rest items)

Add an or more than one element to the end of the queue. Parameters

name -
item1 -
...

Return Value
The length of the list after the push operation, false on error.

Package

cl-ssdb.

Source

commands.lisp.

Function: qpush_front (name &rest items)

Add one or more than one element to the head of the queue. Parameters

name -
item1 -
...

Return Value
The length of the list after the push operation, false on error.

Package

cl-ssdb.

Source

commands.lisp.

Function: qrange (name offset limit)

Returns a portion of elements from the queue at the specified range [offset, offset + limit]. Parameters

name -
offset -
limit -

Return Value
false on error, otherwise an array containing items.

Package

cl-ssdb.

Source

commands.lisp.

Function: qrlist (name_start name_end limit)

Like qlist, but in reverse order.

Package

cl-ssdb.

Source

commands.lisp.

Function: qset (name index val)

Sets the list element at index to value. An error is returned for out of range indexes. Parameters

name -
index - negative intexes accepted.
val -

Return Value
false on error, other values indicate OK.

Package

cl-ssdb.

Source

commands.lisp.

Function: qsize (name)

Returns the number of items in the queue.
Parameters

name -

Return Value
false on error, otherwise an integer, 0 if the queue does not exist.

Package

cl-ssdb.

Source

commands.lisp.

Function: qslice (name begin end)

Returns a portion of elements from the queue at the specified range [begin, end]. begin and end could be negative. Parameters

name -
begin -
end -

Return Value
false on error, otherwise an array containing items.

Package

cl-ssdb.

Source

commands.lisp.

Function: qtrim_back (name size)

Remove multi elements from the tail of a queue. Parameters

name -
size - Number of elements to delete.

Return Value
false on error. Return the number of elements removed.

Package

cl-ssdb.

Source

commands.lisp.

Function: qtrim_front (name size)

Remove multi elements from the head of a queue. Parameters

name -
size - Number of elements to delete.

Return Value
false on error. Return the number of elements removed.

Package

cl-ssdb.

Source

commands.lisp.

Function: reconnect ()

Close and reopen the connection to SSDB server.

Package

cl-ssdb.

Source

connection.lisp.

Function: rkeys (key_start key_end limit)

Since 1.9.0
Like keys, but in reverse order.

Package

cl-ssdb.

Source

commands.lisp.

Function: rscan (key_start key_end limit)

Like scan, but in reverse order.

Package

cl-ssdb.

Source

commands.lisp.

Function: scan (key_start key_end limit)

List key-value pairs with keys in range (key_start, key_end].
("", ""] means no range limit.
This command can do wildchar * like search, but only prefix search, and the * char must never occur in key_start and key_end! Parameters

key_start - The lower bound(not included) of keys to be returned, empty string means -inf(no limit).
key_end - The upper bound(inclusive) of keys to be returned, empty string means +inf(no limit).
limit - Up to that many pairs will be returned.

Return Value
false on error, otherwise an associative array containing the key-value pairs.

Package

cl-ssdb.

Source

commands.lisp.

Function: set (key value)

Set the value of the key.

Parameters
key -
value -

Return Value
false on error, other values indicate OK.

Package

cl-ssdb.

Source

commands.lisp.

Function: setbit (key offset val)

Changes a single bit of a string. The string is auto expanded.
Parameters

key -
offset - bit offset, must in range of [0, 1073741824].
val - 0 or 1.

Return Value
The value of the bit before it was set: 0 or 1. If val is not 0 or 1, returns false.

Package

cl-ssdb.

Source

commands.lisp.

Function: setnx (key value)

Set the string value in argument as value of the key if and only if the key doesn’t exist.

Parameters
key -
value -

Return Value
1: value is set, 0: key already exists.

Package

cl-ssdb.

Source

commands.lisp.

Function: setx (key value ttl)

Set the value of the key, with a time to live.

Unlike Redis, the ttl will not be remove when later set the same key!

Parameters
key -
value -
ttl - number of seconds to live.

Return Value
false on error, other values indicate OK.

Package

cl-ssdb.

Source

commands.lisp.

Function: strlen (key)

Return the number of bytes of a string.
Parameters

key -

Return Value
The number of bytes of the string, if key not exists, returns 0.

Package

cl-ssdb.

Source

commands.lisp.

Function: substr (key start size)

Return part of a string, like PHP’s substr() function.
Parameters

key -
start - Optional, the offset of first byte returned. If start is negative, the returned string will start at the start’th character from the end of string. size - Optional, number of bytes returned. If size is negative, then that many characters will be omitted from the end of string.

Return Value
The extracted part of the string.

Package

cl-ssdb.

Source

commands.lisp.

Function: ttl (key)

Returns the time left to live in seconds, only for keys of KV type.

Parameters
key -

Return Value
Time to live of the key, in seconds, -1 if there is no associated expire to the key.

Package

cl-ssdb.

Source

commands.lisp.

Function: zavg (name score_start score_end)

Returns the average of elements of the sorted set stored at the specified key which have scores in the range [start,end]. Parameters

name - The name of the zset.
score_start - The minimum score related to keys(inclusive), empty string means -inf(no limit).
score_end - The maximum score related to keys(inclusive), empty string means +inf(no limit).

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zclear (name)

Delete all keys in a zset. Parameters

name - Name of the zset

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zcount (name score_start score_end)

Returns the number of elements of the sorted set stored at the specified key which have scores in the range [start,end]. Parameters

name - The name of the zset.
score_start - The minimum score related to keys(inclusive), empty string means -inf(no limit).
score_end - The maximum score related to keys(inclusive), empty string means +inf(no limit).

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zdel (name key)

Delete specified key of a zset. Parameters

name - Name of the zset
key -

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zexists (name key)

Verify if the specified key exists in a zset. Parameters

name - Name of the zset
key -

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zget (name key)

Get the score related to the specified key of a zset Parameters

name - Name of the zset
key -

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zincr (name key num)

Increment the number stored at key in a zset by num. Parameters

name - Name of the zset
key -
num - Must be a signed integer.

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zkeys (name key_start score_start score_end limit)

List keys in a zset. Parameters

name - Name of the zset key_start - score_start - score_end -
limit -

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zlist (name_start name_end limit)

List zset names in range (name_start, name_end].
Refer to scan command for more information about how it work. Parameters

name - Name of the zset
name_start -
name_end -
limit -

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zpop_back (name limit)

Since 1.9.0
Delete and return limit element(s) from back of the zset. Parameters

name - The name of the zset
limit -

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zpop_front (name limit)

Since 1.9.0
Delete and return limit element(s) from front of the zset. Parameters

name - The name of the zset
limit -

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zrange (name offset limit)

Returns a range of key-score pairs by index range [offset, offset + limit). Parameters

name - Name of the zset
offset - Positive integer, the returned pairs will start at this offset. limit - Positive integer, up to this number of pairs will be returned.

Return Value
key-score list

Package

cl-ssdb.

Source

commands.lisp.

Function: zrank (name key)

Returns the rank(index) of a given key in the specified sorted set. Parameters

name - Name of the zset
key -

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zremrangebyrank (name start end)

Delete the elements of the zset which have rank in the range [start,end]. Parameters

name - Name of the zset

Return Value
count of deleted keys

Package

cl-ssdb.

Source

commands.lisp.

Function: zremrangebyscore (name start end)

Delete the elements of the zset which have score in the range [start,end]. Parameters

name - Name of the zset

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zrlist (name_start name_end limit)

List zset names in range (name_start, name_end], in reverse order. Parameters

name - Name of the zset
name_start -
name_end -
limit -

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zrrange (name offset limit)

Returns a range of key-score pairs by index range [offset, offset + limit), in reverse order. Parameters

name - Name of the zset

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zrrank (name key)

Returns the rank(index) of a given key in the specified sorted set, in reverse order. Parameters

name - Name of the zset

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zrscan (name key_start score_start score_end limit)

List key-score pairs of a zset, in reverse order. See method zkeys(). Parameters

name - Name of the zset

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zscan (name key_start score_start score_end limit)

List key-score pairs where key-score in range (key_start+score_start, score_end]. Refer to scan command for more information about how it work.
Parameters

name - Name of the zset

Return Value
key-score list

Package

cl-ssdb.

Source

commands.lisp.

Function: zset (name key score)

Set the score of the key of a zset. Parameters

name - Name of the zset
key -
score -

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zsize (name)

Return the number of pairs of a zset. Parameters

name - The name of the zset

Return Value

Package

cl-ssdb.

Source

commands.lisp.

Function: zsum (name score_start score_end)

Returns the sum of elements of the sorted set stored at the specified key which have scores in the range [start,end]. Parameters

name - The name of the zset.
score_start - The minimum score related to keys(inclusive), empty string means -inf(no limit).
score_end - The maximum score related to keys(inclusive), empty string means +inf(no limit).

Return Value

Package

cl-ssdb.

Source

commands.lisp.


5.1.4 Generic functions

Generic Function: tell (cmd &rest args)

Send a command to SSDB server over a socket connection.
CMD is the command name (a string or a symbol), and ARGS are its arguments (keyword arguments are also supported).

Package

cl-ssdb.

Source

cl-ssdb.lisp.

Methods
Method: tell (cmd &rest args)
Method: tell :after (cmd &rest args)

5.1.5 Standalone methods

Method: initialize-instance :after ((conn ssdb-connection) &key)
Source

connection.lisp.


5.1.6 Conditions

Condition: ssdb-bad-reply

SSDB protocol error is detected.

Package

cl-ssdb.

Source

cl-ssdb.lisp.

Direct superclasses

ssdb-error.

Condition: ssdb-connection-error

Conditions of this type are signaled when errors occur
that break the connection stream. They offer a :RECONNECT restart.

Package

cl-ssdb.

Source

cl-ssdb.lisp.

Direct superclasses

ssdb-error.

Condition: ssdb-error

Any SSDB-related error.

Package

cl-ssdb.

Source

cl-ssdb.lisp.

Direct superclasses

error.

Direct subclasses
Direct methods
Direct slots
Slot: error
Package

common-lisp.

Initform

(quote nil)

Initargs

:error

Readers

ssdb-error-error.

Writers

This slot is read-only.

Slot: message
Initform

(quote nil)

Initargs

:message

Readers

ssdb-error-message.

Writers

This slot is read-only.

Condition: ssdb-error-reply

Error reply is received from SSDB server.

Package

cl-ssdb.

Source

cl-ssdb.lisp.

Direct superclasses

ssdb-error.


5.1.7 Classes

Class: ssdb-connection

Representation of a SSDB connection.

Package

cl-ssdb.

Source

connection.lisp.

Direct methods
Direct slots
Slot: host
Initform

cl-ssdb::+default-host+

Initargs

:host

Readers

conn-host.

Writers

This slot is read-only.

Slot: port
Initform

cl-ssdb::+default-port+

Initargs

:port

Readers

conn-port.

Writers

This slot is read-only.

Slot: auth
Initargs

:auth

Readers

conn-auth.

Writers

This slot is read-only.

Slot: socket
Readers

conn-socket.

Writers

(setf conn-socket).

Slot: stream
Package

common-lisp.

Readers

conn-stream.

Writers

(setf conn-stream).


5.2 Internals


5.2.1 Constants

Constant: +default-host+
Package

cl-ssdb.

Source

connection.lisp.

Constant: +default-port+
Package

cl-ssdb.

Source

connection.lisp.

Constant: +utf8+
Package

cl-ssdb.

Source

connection.lisp.


5.2.2 Special variables

Special Variable: *cmd-prefix*

Prefix for functions names that implement SSDB commands.

Package

cl-ssdb.

Source

cl-ssdb.lisp.

Special Variable: *pipeline*

A list of expected results from the current pipeline.

Package

cl-ssdb.

Source

cl-ssdb.lisp.

Special Variable: *pipelined*

Indicates, that commands are sent in pipelined mode.

Package

cl-ssdb.

Source

cl-ssdb.lisp.


5.2.3 Macros

Macro: defconstant (name value &optional doc)

Make sure VALUE is evaluated only once (to appease SBCL).

Package

cl-ssdb.

Source

connection.lisp.

Macro: reconnect-restart-case ((&key error comment) &body body)

Signal the condition of type SSDB-CONNECTION-ERROR denoted by
the given ERROR and COMMENT offering a :RECONNECT restart to re-evaluate BODY.

Package

cl-ssdb.

Source

connection.lisp.

Macro: with-reconnect-restart (&body body)

When, during the execution of BODY, an error occurs that breaks the connection, a SSDB-CONNECTION-ERROR is signalled, offering a :RECONNECT restart that will re-evaluate body after the conenction is re-established.

Package

cl-ssdb.

Source

connection.lisp.


5.2.4 Ordinary functions

Function: connection-open-p (conn)

Is the socket of CONNECTION open?

Package

cl-ssdb.

Source

connection.lisp.

Function: ensure-string (obj)
Package

cl-ssdb.

Source

cl-ssdb.lisp.

Function: receive ()
Package

cl-ssdb.

Source

cl-ssdb.lisp.

Function: reopen-connection (conn)

Close and reopen CONN.

Package

cl-ssdb.

Source

connection.lisp.

Function: version ()

Return SSDB Server’s version string. Note: it is NOT a standard command.

Package

cl-ssdb.

Source

commands.lisp.


5.2.5 Generic functions

Generic Reader: conn-auth (object)
Package

cl-ssdb.

Methods
Reader Method: conn-auth ((ssdb-connection ssdb-connection))

automatically generated reader method

Source

connection.lisp.

Target Slot

auth.

Generic Reader: conn-host (object)
Package

cl-ssdb.

Methods
Reader Method: conn-host ((ssdb-connection ssdb-connection))

automatically generated reader method

Source

connection.lisp.

Target Slot

host.

Generic Reader: conn-port (object)
Package

cl-ssdb.

Methods
Reader Method: conn-port ((ssdb-connection ssdb-connection))

automatically generated reader method

Source

connection.lisp.

Target Slot

port.

Generic Reader: conn-socket (object)
Package

cl-ssdb.

Methods
Reader Method: conn-socket ((ssdb-connection ssdb-connection))

automatically generated reader method

Source

connection.lisp.

Target Slot

socket.

Generic Writer: (setf conn-socket) (object)
Package

cl-ssdb.

Methods
Writer Method: (setf conn-socket) ((ssdb-connection ssdb-connection))

automatically generated writer method

Source

connection.lisp.

Target Slot

socket.

Generic Reader: conn-stream (object)
Package

cl-ssdb.

Methods
Reader Method: conn-stream ((ssdb-connection ssdb-connection))

automatically generated reader method

Source

connection.lisp.

Target Slot

stream.

Generic Writer: (setf conn-stream) (object)
Package

cl-ssdb.

Methods
Writer Method: (setf conn-stream) ((ssdb-connection ssdb-connection))

automatically generated writer method

Source

connection.lisp.

Target Slot

stream.

Generic Function: expect (type)

Receive and process the reply of the given type from SSDB server.

Package

cl-ssdb.

Source

cl-ssdb.lisp.

Methods
Method: expect ((type (eql :end)))
Method: expect ((type (eql :bulk)))

Receive and process data reply, which is just a string.

Method: expect ((type (eql :list)))

Receive and process data reply, which is a list of string.

Method: expect ((type (eql :boolean)))
Method: expect ((type (eql :number)))
Method: expect ((type (eql :integer)))
Method: expect ((type (eql :status)))

Receive and process status reply, which is just a string.

Method: expect :around (type)
Generic Reader: ssdb-error-error (condition)
Package

cl-ssdb.

Methods
Reader Method: ssdb-error-error ((condition ssdb-error))
Source

cl-ssdb.lisp.

Target Slot

error.

Generic Reader: ssdb-error-message (condition)
Package

cl-ssdb.

Methods
Reader Method: ssdb-error-message ((condition ssdb-error))
Source

cl-ssdb.lisp.

Target Slot

message.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   B   C   D   E   F   G   H   I   L   M   O   P   Q   R   S   T   V   W   Z  
Index Entry  Section

(
(setf conn-socket): Private generic functions
(setf conn-socket): Private generic functions
(setf conn-stream): Private generic functions
(setf conn-stream): Private generic functions

A
add_allow_ip: Public ordinary functions
add_deny_ip: Public ordinary functions
auth: Public ordinary functions

B
bitcount: Public ordinary functions

C
clear_binlog: Public ordinary functions
close-connection: Public ordinary functions
compact: Public ordinary functions
conn-auth: Private generic functions
conn-auth: Private generic functions
conn-host: Private generic functions
conn-host: Private generic functions
conn-port: Private generic functions
conn-port: Private generic functions
conn-socket: Private generic functions
conn-socket: Private generic functions
conn-stream: Private generic functions
conn-stream: Private generic functions
connect: Public ordinary functions
connected-p: Public ordinary functions
connection-open-p: Private ordinary functions
countbit: Public ordinary functions

D
dbsize: Public ordinary functions
def-cmd: Public macros
defconstant: Private macros
del: Public ordinary functions
del_allow_ip: Public ordinary functions
del_deny_ip: Public ordinary functions
disconnect: Public ordinary functions

E
ensure-string: Private ordinary functions
exists: Public ordinary functions
expect: Private generic functions
expect: Private generic functions
expect: Private generic functions
expect: Private generic functions
expect: Private generic functions
expect: Private generic functions
expect: Private generic functions
expect: Private generic functions
expect: Private generic functions
expire: Public ordinary functions

F
flushdb: Public ordinary functions
Function, add_allow_ip: Public ordinary functions
Function, add_deny_ip: Public ordinary functions
Function, auth: Public ordinary functions
Function, bitcount: Public ordinary functions
Function, clear_binlog: Public ordinary functions
Function, close-connection: Public ordinary functions
Function, compact: Public ordinary functions
Function, connect: Public ordinary functions
Function, connected-p: Public ordinary functions
Function, connection-open-p: Private ordinary functions
Function, countbit: Public ordinary functions
Function, dbsize: Public ordinary functions
Function, del: Public ordinary functions
Function, del_allow_ip: Public ordinary functions
Function, del_deny_ip: Public ordinary functions
Function, disconnect: Public ordinary functions
Function, ensure-string: Private ordinary functions
Function, exists: Public ordinary functions
Function, expire: Public ordinary functions
Function, flushdb: Public ordinary functions
Function, get: Public ordinary functions
Function, getbit: Public ordinary functions
Function, getset: Public ordinary functions
Function, hclear: Public ordinary functions
Function, hdel: Public ordinary functions
Function, hexists: Public ordinary functions
Function, hget: Public ordinary functions
Function, hgetall: Public ordinary functions
Function, hincr: Public ordinary functions
Function, hkeys: Public ordinary functions
Function, hlist: Public ordinary functions
Function, hrlist: Public ordinary functions
Function, hrscan: Public ordinary functions
Function, hscan: Public ordinary functions
Function, hset: Public ordinary functions
Function, hsize: Public ordinary functions
Function, incr: Public ordinary functions
Function, info: Public ordinary functions
Function, list_allow_ip: Public ordinary functions
Function, list_deny_ip: Public ordinary functions
Function, multi_del: Public ordinary functions
Function, multi_get: Public ordinary functions
Function, multi_hdel: Public ordinary functions
Function, multi_hget: Public ordinary functions
Function, multi_hset: Public ordinary functions
Function, multi_set: Public ordinary functions
Function, multi_zdel: Public ordinary functions
Function, multi_zget: Public ordinary functions
Function, multi_zset: Public ordinary functions
Function, open-connection: Public ordinary functions
Function, ping: Public ordinary functions
Function, qback: Public ordinary functions
Function, qclear: Public ordinary functions
Function, qfront: Public ordinary functions
Function, qget: Public ordinary functions
Function, qlist: Public ordinary functions
Function, qpop: Public ordinary functions
Function, qpop_back: Public ordinary functions
Function, qpop_front: Public ordinary functions
Function, qpush: Public ordinary functions
Function, qpush_back: Public ordinary functions
Function, qpush_front: Public ordinary functions
Function, qrange: Public ordinary functions
Function, qrlist: Public ordinary functions
Function, qset: Public ordinary functions
Function, qsize: Public ordinary functions
Function, qslice: Public ordinary functions
Function, qtrim_back: Public ordinary functions
Function, qtrim_front: Public ordinary functions
Function, receive: Private ordinary functions
Function, reconnect: Public ordinary functions
Function, reopen-connection: Private ordinary functions
Function, rkeys: Public ordinary functions
Function, rscan: Public ordinary functions
Function, scan: Public ordinary functions
Function, set: Public ordinary functions
Function, setbit: Public ordinary functions
Function, setnx: Public ordinary functions
Function, setx: Public ordinary functions
Function, strlen: Public ordinary functions
Function, substr: Public ordinary functions
Function, ttl: Public ordinary functions
Function, version: Private ordinary functions
Function, zavg: Public ordinary functions
Function, zclear: Public ordinary functions
Function, zcount: Public ordinary functions
Function, zdel: Public ordinary functions
Function, zexists: Public ordinary functions
Function, zget: Public ordinary functions
Function, zincr: Public ordinary functions
Function, zkeys: Public ordinary functions
Function, zlist: Public ordinary functions
Function, zpop_back: Public ordinary functions
Function, zpop_front: Public ordinary functions
Function, zrange: Public ordinary functions
Function, zrank: Public ordinary functions
Function, zremrangebyrank: Public ordinary functions
Function, zremrangebyscore: Public ordinary functions
Function, zrlist: Public ordinary functions
Function, zrrange: Public ordinary functions
Function, zrrank: Public ordinary functions
Function, zrscan: Public ordinary functions
Function, zscan: Public ordinary functions
Function, zset: Public ordinary functions
Function, zsize: Public ordinary functions
Function, zsum: Public ordinary functions

G
Generic Function, (setf conn-socket): Private generic functions
Generic Function, (setf conn-stream): Private generic functions
Generic Function, conn-auth: Private generic functions
Generic Function, conn-host: Private generic functions
Generic Function, conn-port: Private generic functions
Generic Function, conn-socket: Private generic functions
Generic Function, conn-stream: Private generic functions
Generic Function, expect: Private generic functions
Generic Function, ssdb-error-error: Private generic functions
Generic Function, ssdb-error-message: Private generic functions
Generic Function, tell: Public generic functions
get: Public ordinary functions
getbit: Public ordinary functions
getset: Public ordinary functions

H
hclear: Public ordinary functions
hdel: Public ordinary functions
hexists: Public ordinary functions
hget: Public ordinary functions
hgetall: Public ordinary functions
hincr: Public ordinary functions
hkeys: Public ordinary functions
hlist: Public ordinary functions
hrlist: Public ordinary functions
hrscan: Public ordinary functions
hscan: Public ordinary functions
hset: Public ordinary functions
hsize: Public ordinary functions

I
incr: Public ordinary functions
info: Public ordinary functions
initialize-instance: Public standalone methods

L
list_allow_ip: Public ordinary functions
list_deny_ip: Public ordinary functions

M
Macro, def-cmd: Public macros
Macro, defconstant: Private macros
Macro, reconnect-restart-case: Private macros
Macro, with-connection: Public macros
Macro, with-persistent-connection: Public macros
Macro, with-pipelining: Public macros
Macro, with-reconnect-restart: Private macros
Macro, with-recursive-connection: Public macros
Method, (setf conn-socket): Private generic functions
Method, (setf conn-stream): Private generic functions
Method, conn-auth: Private generic functions
Method, conn-host: Private generic functions
Method, conn-port: Private generic functions
Method, conn-socket: Private generic functions
Method, conn-stream: Private generic functions
Method, expect: Private generic functions
Method, expect: Private generic functions
Method, expect: Private generic functions
Method, expect: Private generic functions
Method, expect: Private generic functions
Method, expect: Private generic functions
Method, expect: Private generic functions
Method, expect: Private generic functions
Method, initialize-instance: Public standalone methods
Method, ssdb-error-error: Private generic functions
Method, ssdb-error-message: Private generic functions
Method, tell: Public generic functions
Method, tell: Public generic functions
multi_del: Public ordinary functions
multi_get: Public ordinary functions
multi_hdel: Public ordinary functions
multi_hget: Public ordinary functions
multi_hset: Public ordinary functions
multi_set: Public ordinary functions
multi_zdel: Public ordinary functions
multi_zget: Public ordinary functions
multi_zset: Public ordinary functions

O
open-connection: Public ordinary functions

P
ping: Public ordinary functions

Q
qback: Public ordinary functions
qclear: Public ordinary functions
qfront: Public ordinary functions
qget: Public ordinary functions
qlist: Public ordinary functions
qpop: Public ordinary functions
qpop_back: Public ordinary functions
qpop_front: Public ordinary functions
qpush: Public ordinary functions
qpush_back: Public ordinary functions
qpush_front: Public ordinary functions
qrange: Public ordinary functions
qrlist: Public ordinary functions
qset: Public ordinary functions
qsize: Public ordinary functions
qslice: Public ordinary functions
qtrim_back: Public ordinary functions
qtrim_front: Public ordinary functions

R
receive: Private ordinary functions
reconnect: Public ordinary functions
reconnect-restart-case: Private macros
reopen-connection: Private ordinary functions
rkeys: Public ordinary functions
rscan: Public ordinary functions

S
scan: Public ordinary functions
set: Public ordinary functions
setbit: Public ordinary functions
setnx: Public ordinary functions
setx: Public ordinary functions
ssdb-error-error: Private generic functions
ssdb-error-error: Private generic functions
ssdb-error-message: Private generic functions
ssdb-error-message: Private generic functions
strlen: Public ordinary functions
substr: Public ordinary functions

T
tell: Public generic functions
tell: Public generic functions
tell: Public generic functions
ttl: Public ordinary functions

V
version: Private ordinary functions

W
with-connection: Public macros
with-persistent-connection: Public macros
with-pipelining: Public macros
with-reconnect-restart: Private macros
with-recursive-connection: Public macros

Z
zavg: Public ordinary functions
zclear: Public ordinary functions
zcount: Public ordinary functions
zdel: Public ordinary functions
zexists: Public ordinary functions
zget: Public ordinary functions
zincr: Public ordinary functions
zkeys: Public ordinary functions
zlist: Public ordinary functions
zpop_back: Public ordinary functions
zpop_front: Public ordinary functions
zrange: Public ordinary functions
zrank: Public ordinary functions
zremrangebyrank: Public ordinary functions
zremrangebyscore: Public ordinary functions
zrlist: Public ordinary functions
zrrange: Public ordinary functions
zrrank: Public ordinary functions
zrscan: Public ordinary functions
zscan: Public ordinary functions
zset: Public ordinary functions
zsize: Public ordinary functions
zsum: Public ordinary functions