package redis-async

  1. Overview
  2. Docs
module Key : sig ... end
module Value : sig ... end
type t
val create : ?on_disconnect:(unit -> unit) -> where_to_connect:[< Async.Socket.Address.t ] Async.Tcp.Where_to_connect.t -> unit -> t Async.Deferred.Or_error.t
val close : t -> unit Async.Deferred.t

Redis commands are documented at: https://redis.io/commands

val select : t -> int -> unit Async.Deferred.Or_error.t
val flushall : t -> unit Async.Deferred.Or_error.t
val flushdb : t -> unit Async.Deferred.Or_error.t
val shutdown : t -> unit Async.Deferred.Or_error.t
val incr : t -> Key.t -> int Async.Deferred.Or_error.t
val del : t -> Key.t list -> int Async.Deferred.Or_error.t
val dbsize : t -> int Async.Deferred.Or_error.t
val exists : t -> Key.t list -> int Async.Deferred.Or_error.t
val keys : ?pattern:string -> t -> Key.t list Async.Deferred.Or_error.t
val scan : t -> cursor:int -> ?count:int -> unit -> ([ `Cursor of int ] * Key.t list) Async.Deferred.Or_error.t
val client_tracking : t -> ?bcast:bool -> unit -> [ `All | `Key of Key.t ] Async.Pipe.Reader.t Async.Deferred.Or_error.t

Turn on Redis client tracking and provide a pipe of invalidation messages received from the server. Closing the pipe turns tracking off.

The NOLOOP option is used, which means that subscribers will not see invalidation messages caused by themselves, unless it is from the flushdb / flushall command.

Read here for more on usage: https://redis.io/commands/client-tracking https://redis.io/topics/client-side-caching

  • parameter bcast

    Whether to use BCAST. Off by default.

val set : t -> Key.t -> Value.t -> unit Async.Deferred.Or_error.t
val setnx : t -> Key.t -> Value.t -> bool Async.Deferred.Or_error.t
val mset : t -> (Key.t * Value.t) list -> unit Async.Deferred.Or_error.t
val msetnx : t -> (Key.t * Value.t) list -> bool Async.Deferred.Or_error.t
val get : t -> Key.t -> Value.t option Async.Deferred.Or_error.t
val mget : t -> Key.t list -> Value.t option list Async.Deferred.Or_error.t
val smembers : t -> Key.t -> Value.t list Async.Deferred.Or_error.t
val sismember : t -> Key.t -> Value.t -> bool Async.Deferred.Or_error.t
val smismember : t -> Key.t -> Value.t list -> bool list Async.Deferred.Or_error.t
val sadd : t -> Key.t -> Value.t list -> int Async.Deferred.Or_error.t
val srem : t -> Key.t -> Value.t list -> int Async.Deferred.Or_error.t
val zadd : t -> Key.t -> ([ `Score of float ] * Value.t) list -> int Async.Deferred.Or_error.t
val zrem : t -> Key.t -> Value.t list -> int Async.Deferred.Or_error.t
val zrange : t -> Key.t -> min_index:int -> max_index:int -> Value.t list Async.Deferred.Or_error.t