package trakeva

  1. Overview
  2. Docs

Add a very greedy cache around an existing Key-value store.

The current implementation loads into memory all the collections that it touches.

Parameters

Signature

type t

The handle to the database.

val load : string -> (t, [> `Database of [> `Load of string ] * string ]) Pvem_lwt_unix.Deferred_result.t

Load a handle from the given database parameters.

val close : t -> (unit, [> `Database of [> `Close ] * string ]) Pvem_lwt_unix.Deferred_result.t

Close the DB.

val get : ?collection:string -> t -> key:string -> (string option, [> `Database of [> `Get of Trakeva.Key_in_collection.t ] * string ]) Pvem_lwt_unix.Deferred_result.t

Get a value in the DB.

val get_all : t -> collection:string -> (string list, [> `Database of [> `Get_all of string ] * string ]) Pvem_lwt_unix.Deferred_result.t

Get all the keys in a given collection as a list.

val iterator : t -> collection:string -> unit -> (string option, [> `Database of [> `Iter of string ] * string ]) Pvem_lwt_unix.Deferred_result.t

Go through all the kets in a given collection (exact semantics versus concurrent writes still to be defined …).

val act : t -> action:Trakeva.Action.t -> ([ `Done | `Not_done ], [> `Database of [> `Act of Trakeva.Action.t ] * string ]) Pvem_lwt_unix.Deferred_result.t

Process a transaction, which can be `Done is successful or `Not_done if one of the checks in the Action.t failed.

OCaml

Innovation. Community. Security.