Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file s.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655moduletypeIO=sigtype'attypefdtypein_channeltypeout_channeltype'astreamtypestream_countvalconnect:string->int->fdtvalclose:fd->unittvalsleep:float->unittval(>>=):'at->('a->'bt)->'btval(>|=):'at->('a->'b)->'btvalcatch:(unit->'at)->(exn->'at)->'atvaltry_bind:(unit->'at)->('a->'bt)->(exn->'bt)->'btvalignore_result:'at->unitvalreturn:'a->'atvalfail:exn->'atvalrun:'at->'avalatomic:(in_channel->'at)->in_channel->'atvalin_channel_of_descr:fd->in_channelvalout_channel_of_descr:fd->out_channelvalinput_char:in_channel->chartvalreally_input:in_channel->bytes->int->int->unittvaloutput_string:out_channel->string->unittvalflush:out_channel->unittvaliter:('a->unitt)->'alist->unittvaliter_serial:('a->unitt)->'alist->unittvalmap:('a->'bt)->'alist->'blisttvalmap_serial:('a->'bt)->'alist->'blisttvalfold_left:('a->'b->'at)->'a->'blist->'atvalstream_from:(stream_count->'boptiont)->'bstreamvalstream_next:'astream->'atendmoduletypeClient=sigmoduleIO:IOmoduleStringBound:sigtypet=NegInfinity|PosInfinity|Exclusiveofstring|Inclusiveofstringvalto_string:t->stringendmoduleFloatBound:sigtypet=NegInfinity|PosInfinity|Exclusiveoffloat|Inclusiveoffloatvalto_string:t->stringend(** {2 Types and exceptions } *)typeredirection={slot:int;host:string;port:int;}typereply=[|`Statusofstring|`Errorofstring|`Intofint|`Int64ofInt64.t|`Bulkofstringoption|`Multibulkofreplylist|`Askofredirection|`Movedofredirection]valstring_of_reply:reply->string(** For debugging purpose *)(** Server connection info *)typeconnection_spec={host:string;port:int;}moduleSlotMap:Map.Swithtypekey=intmoduleConnectionSpecMap:Map.Swithtypekey=connection_spectypecluster_connections=private{mutableconnections_spec:connection_specSlotMap.t;mutableconnections:connectionConnectionSpecMap.t;}andconnection=private{fd:IO.fd;in_ch:IO.in_channel;out_ch:IO.out_channel;stream:replylistIO.stream;cluster:cluster_connections;}(** Error responses from server *)exceptionRedis_errorofstring(** Protocol errors *)exceptionUnexpectedofreplyexceptionUnrecognizedofstring*string(* explanation, data *)(** Possible BITOP operations *)typebit_operation=AND|OR|XOR|NOT(** {2 Connection handling } *)valconnect:connection_spec->connectionIO.tvaldisconnect:connection->unitIO.tvalwith_connection:connection_spec->(connection->'aIO.t)->'aIO.tvalstream:connection->replylistIO.stream(** {2 Connection commands } *)(** Authenticate to server. *)valauth:connection->string->unitIO.t(** Echo given string. *)valecho:connection->string->stringoptionIO.t(** Ping connection; returns [ true ] if ping was successfull. *)valping:connection->boolIO.t(** Close connection. *)valquit:connection->unitIO.t(** Switch to a different db; raises {!Error} if index is invalid. *)valselect:connection->int->unitIO.t(** {2 SENTINEL commands } *)valsentinel_masters:connection->(string*string)listlistIO.tvalsentinel_get_master_addr_by_name:connection->string->(string*string)optionIO.t(** {2 Keys commands} *)(** Delete a key; returns the number of keys removed. *)valdel:connection->stringlist->intIO.t(** Determine if a key exists. *)valexists:connection->string->boolIO.t(** Set a key's time to live in seconds; returns [ true ] if timeout was set, false otherwise. *)valexpire:connection->string->int->boolIO.t(** Set a key's time to live in milliseconds; returns [ true ] if timeout was set, false otherwise. *)valpexpire:connection->string->int->boolIO.t(** 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. *)valexpireat:connection->string->float->boolIO.t(** Set the expiration for a key as a UNIX timestamp in milliseconds; returns [ true ] if timeout was set, [ false ] otherwise. *)valpexpireat:connection->string->int->boolIO.t(** Find all keys matching the given pattern. *)valkeys:connection->string->stringlistIO.t(** Incrementally iterate the keys space; see tests for usage example. *)valscan:?pattern:string->?count:int->connection->int->(int*stringlist)IO.t(** Move key to a different db; returns [ true ] if key was moved, [ false ] otherwise. *)valmove:connection->string->int->boolIO.t(** Remove timeout on key; returns [ true ] if timeout was removed, [ false ] otherwise. *)valpersist:connection->string->boolIO.t(** Return a random key from the keyspace; returns [ None ] if db is empty. *)valrandomkey:connection->stringoptionIO.t(** Rename a key; raises {!Error} if key doesn't exist. *)valrename:connection->string->string->unitIO.t(** Rename a key, only if the new key does not exist; returns [ true ] if key was renamed, [ false ] if newkey already exists. *)valrenamenx:connection->string->string->boolIO.t(** Sort elements in a list, set or sorted set; return sorted list of items. *)valsort:connection->?by:string->?limit:int*int->?get:'alist->?order:[<`Asc|`Desc]->?alpha:bool->string->stringlistIO.t(** Sort and store elements in a list, set or sorted set; returns length of sorted items list which was stored. *)valsort_and_store:connection->?by:string->?limit:int*int->?get:'alist->?order:[<`Asc|`Desc]->?alpha:bool->string->string->intIO.t(** Time to live for a key in seconds; returns [ None ] if key doesn't exist or doesn't have a timeout. *)valttl:connection->string->intoptionIO.t(** Time to live for a key in milliseconds; returns [ None ] if key doesn't exist or doesn't have a timeout. *)valpttl:connection->string->intoptionIO.t(** Determine the type stored as key. *)valtype_of:connection->string->[>`Hash|`List|`None|`String|`Zset]IO.t(** Return a serialized version of the value stored at the specified key; returns [ None ] if key doesn't exist. *)valdump:connection->string->stringoptionIO.t(** Create a key with serialized value (obtained via DUMP). *)valrestore:connection->string->int->string->unitIO.t(** Atomically transfer a key from a source Redis instance to a destination Redis instance. *)valmigrate:connection->?copy:bool->?replace:bool->string->int->string->int->int->unitIO.t(** Inspect the internals of Redis objects; returns the number of references of the value associated with the specified key. *)valobject_refcount:connection->string->intoptionIO.t(** Inspect the internals of Redis objects; returns the kind of internal representation used in order to store the value associated with a key. *)valobject_encoding:connection->string->stringoptionIO.t(** Inspect the internals of Redis objects; returns the number of seconds since the object stored at the specified key is idle. *)valobject_idletime:connection->string->intoptionIO.t(** {2 String commands} *)(** Append a value to a key; returns length of string after append. *)valappend:connection->string->string->intIO.t(** Sets or clears the bit at offset in the string value stored at key. *)valsetbit:connection->string->int->int->intIO.t(** Returns the bit value at offset in the string value stored at key. *)valgetbit:connection->string->int->intIO.t(** 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. *)valbitop:connection->bit_operation->string->stringlist->intIO.t(** Count the number of set bits (population counting) in a string. *)valbitcount:?first:int->?last:int->connection->string->intIO.t(** Return the position of the first bit set to 1 or 0 in a string. *)valbitpos:?first:int->?last:int->connection->string->int->intIO.t(** Decrements the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. *)valdecr:connection->string->intIO.t(** Decrements the number stored at key by decrement. If the key does not exist, it is set to 0 before performing the operation. *)valdecrby:connection->string->int->intIO.t(** Get the value of key. *)valget:connection->string->stringoptionIO.t(** Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive). *)valgetrange:connection->string->int->int->stringoptionIO.t(** 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. *)valgetset:connection->string->string->stringoptionIO.t(** Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. *)valincr:connection->string->intIO.t(** Increments the number stored at key by increment. If the key does not exist, it is set to 0 before performing the operation. *)valincrby:connection->string->int->intIO.t(** 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. *)valincrbyfloat:connection->string->float->floatIO.t(** Returns the values of all specified keys. *)valmget:connection->stringlist->stringoptionlistIO.t(** Sets the given keys to their respective values. *)valmset:connection->(string*string)list->unitIO.t(** Sets the given keys to their respective values. MSETNX will not perform any operation at all even if just a single key already exists. *)valmsetnx:connection->(string*string)list->boolIO.t(** Set key to hold the string value. *)valset:connection->?ex:int->?px:int->?nx:bool->?xx:bool->string->string->boolIO.t(** Set key to hold the string value and set key to timeout after a given number of seconds. *)valsetex:connection->string->int->string->unitIO.t(** PSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds instead of seconds. *)valpsetex:connection->string->int->string->unitIO.t(** Set key to hold string value if key does not exist. *)valsetnx:connection->string->string->boolIO.t(** Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value. *)valsetrange:connection->string->int->string->intIO.t(** Returns the length of the string value stored at key. An error is returned when key holds a non-string value. *)valstrlen:connection->string->intIO.t(** {2 Hash commands} *)(** Removes the specified fields from the hash stored at key. Specified fields that do not exist within this hash are ignored. *)valhdel:connection->string->string->boolIO.t(** Returns if field is an existing field in the hash stored at key. *)valhexists:connection->string->string->boolIO.t(** Returns the value associated with field in the hash stored at key. *)valhget:connection->string->string->stringoptionIO.t(** Returns all fields and values of the hash stored at key. *)valhgetall:connection->string->(string*string)listIO.t(** Increments the number stored at field in the hash stored at key by increment. *)valhincrby:connection->string->string->int->intIO.t(** Increments the number stored at field in the hash stored at key by increment. *)valhincrbyfloat:connection->string->string->float->floatIO.t(** Returns all field names in the hash stored at key. *)valhkeys:connection->string->stringlistIO.t(** Returns the number of fields contained in the hash stored at key. *)valhlen:connection->string->intIO.t(** Returns the values associated with the specified fields in the hash stored at key. *)valhmget:connection->string->stringlist->stringoptionlistIO.t(** Sets the specified fields to their respective values in the hash stored at key. *)valhmset:connection->string->(string*string)list->unitIO.t(** Sets field in the hash stored at key to value. *)valhset:connection->string->string->string->boolIO.t(** Sets field in the hash stored at key to value, only if field does not yet exist. *)valhsetnx:connection->string->string->string->boolIO.t(** Get the length of the value of a hash field *)valhstrlen:connection->string->string->intIO.t(** Incrementally iterate hash fields and associated values *)valhscan:?pattern:string->?count:int->connection->string->int->(int*(string*string)list)IO.t(** Returns all values in the hash stored at key. *)valhvals:connection->string->stringlistIO.t(** {2 List commands} *)(** Remove and get the first element in a list, or block until one is available *)valblpop:connection->stringlist->int->(string*string)optionIO.t(** Remove and get the last element in a list, or block until one is available *)valbrpop:connection->stringlist->int->(string*string)optionIO.t(** Pop a value from a list, push it to another list and return it; or block until one is available *)valbrpoplpush:connection->string->string->int->stringoptionIO.t(** Get an element from a list by its index *)vallindex:connection->string->int->stringoptionIO.t(** Insert an element before or after another element in a list *)vallinsert:connection->string->[<`After|`Before]->string->string->intoptionIO.t(** Get the length of a list *)valllen:connection->string->intIO.t(** Remove and get the first element in a list *)vallpop:connection->string->stringoptionIO.t(** Prepend one or multiple values to a list *)vallpush:connection->string->stringlist->intIO.t(** Prepend a value to a list, only if the list exists *)vallpushx:connection->string->stringlist->intIO.t(** Get a range of elements from a list *)vallrange:connection->string->int->int->stringlistIO.t(** Remove elements from a list *)vallrem:connection->string->int->string->intIO.t(** Set the value of an element in a list by its index *)vallset:connection->string->int->string->unitIO.t(** Trim a list to the specified range *)valltrim:connection->string->int->int->unitIO.t(** Remove and get the last element in a list *)valrpop:connection->string->stringoptionIO.t(** Remove the last element in a list, prepend it to another list and return it *)valrpoplpush:connection->string->string->stringoptionIO.t(** Append one or multiple values to a list *)valrpush:connection->string->stringlist->intIO.t(** Append a value to a list, only if the list exists *)valrpushx:connection->string->stringlist->intIO.t(** {2 HyperLogLog commands} *)(** Adds values to the HyperLogLog data structure. *)valpfadd:connection->string->stringlist->boolIO.t(** Returns the approximated cardinality of the union of the HyperLogLogs passed. *)valpfcount:connection->stringlist->intIO.t(** 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. *)valpfmerge:connection->stringlist->unitIO.t(** {2 Set commands} *)(* Returns true if member was added, false otherwise. *)valsadd:connection->string->string->boolIO.tvalscard:connection->string->intIO.t(* Difference between first and all successive sets. *)valsdiff:connection->stringlist->stringlistIO.t(* like sdiff, but store result in destination. returns size of result. *)valsdiffstore:connection->string->stringlist->intIO.tvalsinter:connection->stringlist->stringlistIO.t(* Like SINTER, but store result in destination. Returns size of result. *)valsinterstore:connection->string->stringlist->intIO.tvalsismember:connection->string->string->boolIO.tvalsmembers:connection->string->stringlistIO.t(* Returns true if an element was moved, false otherwise. *)valsmove:connection->string->string->string->boolIO.t(* Remove random element from set. *)valspop:connection->string->stringoptionIO.t(* Like SPOP, but doesn't remove chosen element. *)valsrandmember:connection->string->stringoptionIO.t(* Returns true if element was removed. *)valsrem:connection->string->string->boolIO.tvalsunion:connection->stringlist->stringlistIO.t(* Like SUNION, but store result in destination. Returns size of result. *)valsunionstore:connection->string->stringlist->intIO.t(** {2 Pub/sub commands} *)(* Post a message to a channel. Returns number of clients that received the message. *)valpublish:connection->string->string->intIO.t(* Lists the currently active channels. If no pattern is specified, all channels are listed. *)valpubsub_channels:connection->stringoption->replylistIO.t(* Returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels. *)valpubsub_numsub:connection->stringlist->replylistIO.t(* Subscribes the client to the specified channels. *)valsubscribe:connection->stringlist->unitIO.t(* Unsubscribes the client from the given channels, or from all of them if an empty list is given *)valunsubscribe:connection->stringlist->unitIO.t(* Subscribes the client to the given patterns. *)valpsubscribe:connection->stringlist->unitIO.t(* Unsubscribes the client from the given patterns. *)valpunsubscribe:connection->stringlist->unitIO.t(** {2 Sorted set commands} *)(* Add one or more members to a sorted set, or update its score if it already exists. *)valzadd:connection->?x:[<`NX|`XX]->?ch:bool->string->(float*string)list->intIO.t(* Return a range of members in a sorted set, by index. *)valzrange:connection->?withscores:bool->string->int->int->replylistIO.t(* Return a reversed range of members in a sorted set, by index. *)valzrevrange:connection->?withscores:bool->string->int->int->replylistIO.t(* Return a range of members in a sorted set, by score. *)valzrangebyscore:connection->?withscores:bool->?limit:(int*int)->string->FloatBound.t->FloatBound.t->replylistIO.t(* Return a range of members in a sorted set, by lexicographical range. *)valzrangebylex:connection->?limit:(int*int)->string->StringBound.t->StringBound.t->replylistIO.t(* Return a range of members in a sorted set, by score. *)valzrevrangebyscore:connection->?withscores:bool->?limit:(int*int)->string->FloatBound.t->FloatBound.t->replylistIO.t(* Return a range of members in a sorted set, by lexicographical range. *)valzrevrangebylex:connection->?limit:(int*int)->string->StringBound.t->StringBound.t->replylistIO.t(* Remove one or more members from a sorted set. *)valzrem:connection->string->stringlist->intIO.t(* Remove all members in a sorted set between the given lexicographical range. *)valzremrangebylex:connection->string->StringBound.t->StringBound.t->intIO.t(* Remove all members in a sorted set between the given score range. *)valzremrangebyscore:connection->string->FloatBound.t->FloatBound.t->intIO.t(* Remove all members in a sorted set between the given rank range. *)valzremrangebyrank:connection->string->int->int->intIO.t(* Returns the sorted set cardinality (number of elements) of the sorted set stored at key. *)valzcard:connection->string->intIO.t(* Increment the score of a member in the sorted set *)valzincrby:connection->string->float->string->floatIO.t(* Returns the score of a member in the sorted set. *)valzscore:connection->string->string->floatoptionIO.t(* Returns the number of elements in the sorted set at key with a score between min and max. *)valzcount:connection->string->FloatBound.t->FloatBound.t->intIO.t(* Returns the number of members in a sorted set between a given lexicographical range. *)valzlexcount:connection->string->StringBound.t->StringBound.t->intIO.t(* Returns the rank of member in the sorted set stored at key. *)valzrank:connection->string->string->intoptionIO.t(* Returns the reversed rank of member in the sorted set stored at key. *)valzrevrank:connection->string->string->intoptionIO.t(** {2 Transaction commands} *)(* Marks the start of a transaction block. Subsequent commands will be queued for atomic execution using EXEC. *)valmulti:connection->unitIO.t(* Executes all previously queued commands in a transaction and restores the connection state to normal. *)valexec:connection->replylistIO.t(* Flushes all previously queued commands in a transaction and restores the connection state to normal. *)valdiscard:connection->unitIO.t(* Marks the given keys to be watched for conditional execution of a transaction. *)valwatch:connection->stringlist->unitIO.t(* Flushes all the previously watched keys for a transaction. *)valunwatch:connection->unitIO.tvalqueue:(unit->'aIO.t)->unitIO.t(** {2 Scripting commands} *)(* Load the specified Lua script into the script cache. Returns the SHA1 digest of the script for use with EVALSHA. *)valscript_load:connection->string->stringIO.t(* Evaluates a script using the built-in Lua interpreter. *)valeval:connection->string->stringlist->stringlist->replyIO.t(* Evaluates a script cached on the server side by its SHA1 digest. *)valevalsha:connection->string->stringlist->stringlist->replyIO.t(** {2 Server} *)valbgrewriteaof:connection->unitIO.tvalbgsave:connection->unitIO.tvalconfig_resetstat:connection->unitIO.tvaldbsize:connection->intIO.t(* clear all databases *)valflushall:connection->unitIO.t(* clear current database *)valflushdb:connection->unitIO.tvalinfo:connection->(string*string)listIO.t(* last successful save as Unix timestamp *)vallastsave:connection->floatIO.t(* role in context of replication *)valrole:connection->replylistIO.t(* synchronous save *)valsave:connection->unitIO.t(* save and shutdown server *)valshutdown:connection->unitIO.tmoduleMassInsert:sigtypecommandvalempty:commandvalset:?ex:int->?px:int->?nx:bool->?xx:bool->string->string->command(** Delete a key; returns the number of keys removed. *)valdel:stringlist->commandvalexpire:string->int->commandvalhset:string->string->string->command(** Removes the specified fields from the hash stored at key. Specified fields that do not exist within this hash are ignored. *)valhdel:string->string->commandvalhget:string->string->commandvalhincrby:string->string->int->commandvalwrite:connection->commandlist->replylistIO.tvalincr:string->commandvaldecr:string->commandendendmoduletypeCache_params=sigtypekeytypedatavalcache_key:key->stringvalcache_expiration:intoptionvaldata_of_string:string->datavalstring_of_data:data->stringendmoduletypeCache=sigmoduleIO:IOmoduleClient:ClientmoduleParams:Cache_paramsvalset:Client.connection->Params.key->Params.data->unitIO.tvalget:Client.connection->Params.key->Params.dataoptionIO.tvaldelete:Client.connection->Params.key->unitendmoduletypeMutex=sigmoduleIO:IOmoduleClient:ClientexceptionErrorofstringvalacquire:Client.connection->?atime:float->?ltime:int->string->string->unitIO.tvalrelease:Client.connection->string->string->unitIO.tvalwith_mutex:Client.connection->?atime:float->?ltime:int->string->(unit->'aIO.t)->'aIO.tend