Page
Library
Module
Module type
Parameter
Class
Class type
Source
Redis_sync.Client
Sourcetype reply = [
| `Status of string
| `Error of string
| `Int of int
| `Int64 of Int64.t
| `Bulk of string option
| `Multibulk of reply list
| `Ask of redirection
| `Moved of redirection
]
Server connection info
type cluster_connections = private {
mutable connections_spec : connection_spec SlotMap.t;
mutable connections : connection ConnectionSpecMap.t;
}
and connection = private {
fd : IO.fd;
in_ch : IO.in_channel;
out_ch : IO.out_channel;
stream : reply list IO.stream;
cluster : cluster_connections;
}
Error responses from server
Possible BITOP operations
Authenticate to server.
Echo given string.
Ping connection; returns true
if ping was successfull.
Close connection.
Switch to a different db; raises Error
if index is invalid.
SENTINEL commands
Delete a key; returns the number of keys removed.
Determine if a key exists.
Set a key's time to live in seconds; returns true
if timeout was set, false otherwise.
Set a key's time to live in milliseconds; returns true
if timeout was set, false otherwise.
Set the expiration for a key as a UNIX timestamp, the time is truncated to the nearest second; returns true
if timeout was set, false
otherwise.
Set the expiration for a key as a UNIX timestamp in milliseconds; returns true
if timeout was set, false
otherwise.
Find all keys matching the given pattern.
Incrementally iterate the keys space; see tests for usage example.
Move key to a different db; returns true
if key was moved, false
otherwise.
Remove timeout on key; returns true
if timeout was removed, false
otherwise.
Return a random key from the keyspace; returns None
if db is empty.
Rename a key; raises Error
if key doesn't exist.
Rename a key, only if the new key does not exist; returns true
if key was renamed, false
if newkey already exists.
val sort :
connection ->
?by:string ->
?limit:(int * int) ->
?get:'a list ->
?order:[< `Asc | `Desc ] ->
?alpha:bool ->
string ->
string list IO.t
Sort elements in a list, set or sorted set; return sorted list of items.
val sort_and_store :
connection ->
?by:string ->
?limit:(int * int) ->
?get:'a list ->
?order:[< `Asc | `Desc ] ->
?alpha:bool ->
string ->
string ->
int IO.t
Sort and store elements in a list, set or sorted set; returns length of sorted items list which was stored.
Time to live for a key in seconds; returns None
if key doesn't exist or doesn't have a timeout.
Time to live for a key in milliseconds; returns None
if key doesn't exist or doesn't have a timeout.
Determine the type stored as key.
Return a serialized version of the value stored at the specified key; returns None
if key doesn't exist.
Create a key with serialized value (obtained via DUMP).
val migrate :
connection ->
?copy:bool ->
?replace:bool ->
string ->
int ->
string ->
int ->
int ->
unit IO.t
Atomically transfer a key from a source Redis instance to a destination Redis instance.
Inspect the internals of Redis objects; returns the number of references of the value associated with the specified key.
Inspect the internals of Redis objects; returns the kind of internal representation used in order to store the value associated with a key.
Inspect the internals of Redis objects; returns the number of seconds since the object stored at the specified key is idle.
Append a value to a key; returns length of string after append.
Sets or clears the bit at offset in the string value stored at key.
Returns the bit value at offset in the string value stored at key.
Perform a bitwise operation between multiple keys (containing string values) and store the result in the destination key. See bit_operation
type for available operations.
Count the number of set bits (population counting) in a string.
Return the position of the first bit set to 1 or 0 in a string.
Decrements the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation.
Decrements the number stored at key by decrement. If the key does not exist, it is set to 0 before performing the operation.
Get the value of key.
Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive).
Atomically sets key to value and returns the old value stored at key. Returns None
when key exists but does not hold a string value.
Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation.
Increments the number stored at key by increment. If the key does not exist, it is set to 0 before performing the operation.
Increment the string representing a floating point number stored at key by the specified increment. If the key does not exist, it is set to 0 before performing the operation.
Returns the values of all specified keys.
Sets the given keys to their respective values.
Sets the given keys to their respective values. MSETNX will not perform any operation at all even if just a single key already exists.
val set :
connection ->
?ex:int ->
?px:int ->
?nx:bool ->
?xx:bool ->
string ->
string ->
bool IO.t
Set key to hold the string value.
Set key to hold the string value and set key to timeout after a given number of seconds.
PSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds instead of seconds.
Set key to hold string value if key does not exist.
Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value.
Returns the length of the string value stored at key. An error is returned when key holds a non-string value.
Removes the specified fields from the hash stored at key. Specified fields that do not exist within this hash are ignored.
Returns if field is an existing field in the hash stored at key.
Returns the value associated with field in the hash stored at key.
Returns all fields and values of the hash stored at key.
Increments the number stored at field in the hash stored at key by increment.
Increments the number stored at field in the hash stored at key by increment.
Returns all field names in the hash stored at key.
Returns the number of fields contained in the hash stored at key.
Returns the values associated with the specified fields in the hash stored at key.
Sets the specified fields to their respective values in the hash stored at key.
Sets field in the hash stored at key to value.
Sets field in the hash stored at key to value, only if field does not yet exist.
Get the length of the value of a hash field
val hscan :
?pattern:string ->
?count:int ->
connection ->
string ->
int ->
(int * (string * string) list) IO.t
Incrementally iterate hash fields and associated values
Returns all values in the hash stored at key.
Remove and get the first element in a list, or block until one is available
Remove and get the last element in a list, or block until one is available
Pop a value from a list, push it to another list and return it; or block until one is available
Get an element from a list by its index
val linsert :
connection ->
string ->
[< `After | `Before ] ->
string ->
string ->
int option IO.t
Insert an element before or after another element in a list
Get the length of a list
Remove and get the first element in a list
Prepend one or multiple values to a list
Prepend a value to a list, only if the list exists
Get a range of elements from a list
Remove elements from a list
Set the value of an element in a list by its index
Trim a list to the specified range
Remove and get the last element in a list
Remove the last element in a list, prepend it to another list and return it
Append one or multiple values to a list
Append a value to a list, only if the list exists
Adds values to the HyperLogLog data structure.
Returns the approximated cardinality of the union of the HyperLogLogs passed.
Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
val zadd :
connection ->
?x:[< `NX | `XX ] ->
?ch:bool ->
string ->
(float * string) list ->
int IO.t
val zrangebyscore :
connection ->
?withscores:bool ->
?limit:(int * int) ->
string ->
FloatBound.t ->
FloatBound.t ->
reply list IO.t
val zrangebylex :
connection ->
?limit:(int * int) ->
string ->
StringBound.t ->
StringBound.t ->
reply list IO.t
val zrevrangebyscore :
connection ->
?withscores:bool ->
?limit:(int * int) ->
string ->
FloatBound.t ->
FloatBound.t ->
reply list IO.t
val zrevrangebylex :
connection ->
?limit:(int * int) ->
string ->
StringBound.t ->
StringBound.t ->
reply list IO.t