Page
Library
Module
Module type
Parameter
Class
Class type
Source
S.ClientSourcemodule StringBound : sig ... endmodule FloatBound : sig ... endtype 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 ]module ConnectionSpecMap : Map.S with type key = connection_spectype 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;}exception Unexpected of replyProtocol errors
val connect : connection_spec -> connection IO.tval disconnect : connection -> unit IO.tval with_connection : connection_spec -> (connection -> 'a IO.t) -> 'a IO.tval stream : connection -> reply list IO.streamval auth : connection -> string -> unit IO.tAuthenticate to server.
val echo : connection -> string -> string option IO.tEcho given string.
val ping : connection -> bool IO.tPing connection; returns true if ping was successfull.
val quit : connection -> unit IO.tClose connection.
val select : connection -> int -> unit IO.tSwitch to a different db; raises Error if index is invalid.
val del : connection -> string list -> int IO.tDelete a key; returns the number of keys removed.
val exists : connection -> string -> bool IO.tDetermine if a key exists.
val expire : connection -> string -> int -> bool IO.tSet a key's time to live in seconds; returns true if timeout was set, false otherwise.
val pexpire : connection -> string -> int -> bool IO.tSet a key's time to live in milliseconds; returns true if timeout was set, false otherwise.
val expireat : connection -> string -> float -> bool IO.tSet 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.
val pexpireat : connection -> string -> int -> bool IO.tSet the expiration for a key as a UNIX timestamp in milliseconds; returns true if timeout was set, false otherwise.
val keys : connection -> string -> string list IO.tFind all keys matching the given pattern.
val scan :
?pattern:string ->
?count:int ->
connection ->
int ->
(int * string list) IO.tIncrementally iterate the keys space; see tests for usage example.
val move : connection -> string -> int -> bool IO.tMove key to a different db; returns true if key was moved, false otherwise.
val persist : connection -> string -> bool IO.tRemove timeout on key; returns true if timeout was removed, false otherwise.
val randomkey : connection -> string option IO.tReturn a random key from the keyspace; returns None if db is empty.
val rename : connection -> string -> string -> unit IO.tRename a key; raises Error if key doesn't exist.
val renamenx : connection -> string -> string -> bool IO.tRename 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.tSort 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.tSort and store elements in a list, set or sorted set; returns length of sorted items list which was stored.
val ttl : connection -> string -> int option IO.tTime to live for a key in seconds; returns None if key doesn't exist or doesn't have a timeout.
val pttl : connection -> string -> int option IO.tTime to live for a key in milliseconds; returns None if key doesn't exist or doesn't have a timeout.
val type_of :
connection ->
string ->
[> `Hash | `List | `None | `String | `Zset ] IO.tDetermine the type stored as key.
val dump : connection -> string -> string option IO.tReturn a serialized version of the value stored at the specified key; returns None if key doesn't exist.
val restore : connection -> string -> int -> string -> unit IO.tCreate a key with serialized value (obtained via DUMP).
val migrate :
connection ->
?copy:bool ->
?replace:bool ->
string ->
int ->
string ->
int ->
int ->
unit IO.tAtomically transfer a key from a source Redis instance to a destination Redis instance.
val object_refcount : connection -> string -> int option IO.tInspect the internals of Redis objects; returns the number of references of the value associated with the specified key.
val object_encoding : connection -> string -> string option IO.tInspect the internals of Redis objects; returns the kind of internal representation used in order to store the value associated with a key.
val object_idletime : connection -> string -> int option IO.tInspect the internals of Redis objects; returns the number of seconds since the object stored at the specified key is idle.
val append : connection -> string -> string -> int IO.tAppend a value to a key; returns length of string after append.
val setbit : connection -> string -> int -> int -> int IO.tSets or clears the bit at offset in the string value stored at key.
val getbit : connection -> string -> int -> int IO.tReturns the bit value at offset in the string value stored at key.
val bitop : connection -> bit_operation -> string -> string list -> int IO.tPerform a bitwise operation between multiple keys (containing string values) and store the result in the destination key. See bit_operation type for available operations.
val bitcount : ?first:int -> ?last:int -> connection -> string -> int IO.tCount the number of set bits (population counting) in a string.
val bitpos : ?first:int -> ?last:int -> connection -> string -> int -> int IO.tReturn the position of the first bit set to 1 or 0 in a string.
val decr : connection -> string -> int IO.tDecrements the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation.
val decrby : connection -> string -> int -> int IO.tDecrements the number stored at key by decrement. If the key does not exist, it is set to 0 before performing the operation.
val get : connection -> string -> string option IO.tGet the value of key.
val getrange : connection -> string -> int -> int -> string option IO.tReturns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive).
val getset : connection -> string -> string -> string option IO.tAtomically sets key to value and returns the old value stored at key. Returns None when key exists but does not hold a string value.
val incr : connection -> string -> int IO.tIncrements the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation.
val incrby : connection -> string -> int -> int IO.tIncrements the number stored at key by increment. If the key does not exist, it is set to 0 before performing the operation.
val incrbyfloat : connection -> string -> float -> float IO.tIncrement 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.
val mget : connection -> string list -> string option list IO.tReturns the values of all specified keys.
val mset : connection -> (string * string) list -> unit IO.tSets the given keys to their respective values.
val msetnx : connection -> (string * string) list -> bool IO.tSets 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.tSet key to hold the string value.
val setex : connection -> string -> int -> string -> unit IO.tSet key to hold the string value and set key to timeout after a given number of seconds.
val psetex : connection -> string -> int -> string -> unit IO.tPSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds instead of seconds.
val setnx : connection -> string -> string -> bool IO.tSet key to hold string value if key does not exist.
val setrange : connection -> string -> int -> string -> int IO.tOverwrites part of the string stored at key, starting at the specified offset, for the entire length of value.
val strlen : connection -> string -> int IO.tReturns the length of the string value stored at key. An error is returned when key holds a non-string value.
val hdel : connection -> string -> string -> bool IO.tRemoves the specified fields from the hash stored at key. Specified fields that do not exist within this hash are ignored.
val hexists : connection -> string -> string -> bool IO.tReturns if field is an existing field in the hash stored at key.
val hget : connection -> string -> string -> string option IO.tReturns the value associated with field in the hash stored at key.
val hgetall : connection -> string -> (string * string) list IO.tReturns all fields and values of the hash stored at key.
val hincrby : connection -> string -> string -> int -> int IO.tIncrements the number stored at field in the hash stored at key by increment.
val hincrbyfloat : connection -> string -> string -> float -> float IO.tIncrements the number stored at field in the hash stored at key by increment.
val hkeys : connection -> string -> string list IO.tReturns all field names in the hash stored at key.
val hlen : connection -> string -> int IO.tReturns the number of fields contained in the hash stored at key.
val hmget : connection -> string -> string list -> string option list IO.tReturns the values associated with the specified fields in the hash stored at key.
val hmset : connection -> string -> (string * string) list -> unit IO.tSets the specified fields to their respective values in the hash stored at key.
val hset : connection -> string -> string -> string -> bool IO.tSets field in the hash stored at key to value.
val hsetnx : connection -> string -> string -> string -> bool IO.tSets field in the hash stored at key to value, only if field does not yet exist.
val hstrlen : connection -> string -> string -> int IO.tGet the length of the value of a hash field
val hscan :
?pattern:string ->
?count:int ->
connection ->
string ->
int ->
(int * (string * string) list) IO.tIncrementally iterate hash fields and associated values
val hvals : connection -> string -> string list IO.tReturns all values in the hash stored at key.
val blpop : connection -> string list -> int -> (string * string) option IO.tRemove and get the first element in a list, or block until one is available
val brpop : connection -> string list -> int -> (string * string) option IO.tRemove and get the last element in a list, or block until one is available
val brpoplpush : connection -> string -> string -> int -> string option IO.tPop a value from a list, push it to another list and return it; or block until one is available
val lindex : connection -> string -> int -> string option IO.tGet an element from a list by its index
val linsert :
connection ->
string ->
[< `After | `Before ] ->
string ->
string ->
int option IO.tInsert an element before or after another element in a list
val llen : connection -> string -> int IO.tGet the length of a list
val lpop : connection -> string -> string option IO.tRemove and get the first element in a list
val lpush : connection -> string -> string list -> int IO.tPrepend one or multiple values to a list
val lpushx : connection -> string -> string list -> int IO.tPrepend a value to a list, only if the list exists
val lrange : connection -> string -> int -> int -> string list IO.tGet a range of elements from a list
val lrem : connection -> string -> int -> string -> int IO.tRemove elements from a list
val lset : connection -> string -> int -> string -> unit IO.tSet the value of an element in a list by its index
val ltrim : connection -> string -> int -> int -> unit IO.tTrim a list to the specified range
val rpop : connection -> string -> string option IO.tRemove and get the last element in a list
val rpoplpush : connection -> string -> string -> string option IO.tRemove the last element in a list, prepend it to another list and return it
val rpush : connection -> string -> string list -> int IO.tAppend one or multiple values to a list
val rpushx : connection -> string -> string list -> int IO.tAppend a value to a list, only if the list exists
val pfadd : connection -> string -> string list -> bool IO.tAdds values to the HyperLogLog data structure.
val pfcount : connection -> string list -> int IO.tReturns the approximated cardinality of the union of the HyperLogLogs passed.
val pfmerge : connection -> string list -> unit IO.tMerge 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 sadd : connection -> string -> string -> bool IO.tval scard : connection -> string -> int IO.tval sdiff : connection -> string list -> string list IO.tval sdiffstore : connection -> string -> string list -> int IO.tval sinter : connection -> string list -> string list IO.tval sinterstore : connection -> string -> string list -> int IO.tval sismember : connection -> string -> string -> bool IO.tval smembers : connection -> string -> string list IO.tval smove : connection -> string -> string -> string -> bool IO.tval spop : connection -> string -> string option IO.tval srandmember : connection -> string -> string option IO.tval srem : connection -> string -> string -> bool IO.tval sunion : connection -> string list -> string list IO.tval sunionstore : connection -> string -> string list -> int IO.tval publish : connection -> string -> string -> int IO.tval pubsub_channels : connection -> string option -> reply list IO.tval pubsub_numsub : connection -> string list -> reply list IO.tval subscribe : connection -> string list -> unit IO.tval unsubscribe : connection -> string list -> unit IO.tval psubscribe : connection -> string list -> unit IO.tval punsubscribe : connection -> string list -> unit IO.tval zadd :
connection ->
?x:[< `NX | `XX ] ->
?ch:bool ->
string ->
(float * string) list ->
int IO.tval zrange :
connection ->
?withscores:bool ->
string ->
int ->
int ->
reply list IO.tval zrevrange :
connection ->
?withscores:bool ->
string ->
int ->
int ->
reply list IO.tval zrangebyscore :
connection ->
?withscores:bool ->
?limit:(int * int) ->
string ->
FloatBound.t ->
FloatBound.t ->
reply list IO.tval zrangebylex :
connection ->
?limit:(int * int) ->
string ->
StringBound.t ->
StringBound.t ->
reply list IO.tval zrevrangebyscore :
connection ->
?withscores:bool ->
?limit:(int * int) ->
string ->
FloatBound.t ->
FloatBound.t ->
reply list IO.tval zrevrangebylex :
connection ->
?limit:(int * int) ->
string ->
StringBound.t ->
StringBound.t ->
reply list IO.tval zrem : connection -> string -> string list -> int IO.tval zremrangebylex :
connection ->
string ->
StringBound.t ->
StringBound.t ->
int IO.tval zremrangebyscore :
connection ->
string ->
FloatBound.t ->
FloatBound.t ->
int IO.tval zremrangebyrank : connection -> string -> int -> int -> int IO.tval zcard : connection -> string -> int IO.tval zincrby : connection -> string -> float -> string -> float IO.tval zscore : connection -> string -> string -> float option IO.tval zcount : connection -> string -> FloatBound.t -> FloatBound.t -> int IO.tval zlexcount :
connection ->
string ->
StringBound.t ->
StringBound.t ->
int IO.tval zrank : connection -> string -> string -> int option IO.tval zrevrank : connection -> string -> string -> int option IO.tval multi : connection -> unit IO.tval exec : connection -> reply list IO.tval discard : connection -> unit IO.tval watch : connection -> string list -> unit IO.tval unwatch : connection -> unit IO.tval script_load : connection -> string -> string IO.tval eval : connection -> string -> string list -> string list -> reply IO.tval evalsha : connection -> string -> string list -> string list -> reply IO.tval bgrewriteaof : connection -> unit IO.tval bgsave : connection -> unit IO.tval config_resetstat : connection -> unit IO.tval dbsize : connection -> int IO.tval flushall : connection -> unit IO.tval flushdb : connection -> unit IO.tval info : connection -> (string * string) list IO.tval lastsave : connection -> float IO.tval role : connection -> reply list IO.tval save : connection -> unit IO.tval shutdown : connection -> unit IO.tmodule MassInsert : sig ... end