Module Maki.Storage

type t = {
name : string;
get : string ‑> string option or_error Lwt.t;
set : string ‑> string ‑> unit or_error Lwt.t;
remove : string ‑> unit Lwt.t;
fold : a. f:('a ‑> (string * string) ‑> 'a or_error Lwt.t) ‑> x:'a ‑> 'a or_error Lwt.t;
flush_cache : unit ‑> unit;
}
val name : t ‑> string

Informal description of the storage

val get : t ‑> string ‑> string option or_error Lwt.t

get t k obtains the value for k in t

val get_exn : t ‑> string ‑> string option Lwt.t
val set : t ‑> string ‑> string ‑> unit or_error Lwt.t

set t k v puts the pair k -> v in t

val set_exn : t ‑> string ‑> string ‑> unit Lwt.t
val remove : t ‑> string ‑> unit Lwt.t
val fold : t ‑> f:('a ‑> (string * string) ‑> 'a or_error Lwt.t) ‑> x:'a ‑> 'a or_error Lwt.t

fold ~f ~x t folds over all the pairs key, value in t.

val to_list : t ‑> (string * string) list or_error Lwt.t

Get all bindings in this storage

val flush_cache : t ‑> unit

Flush in-process cache, if any

val none : t

A dummy storage which does not store any result, thus forcing every computation to run.

val default : ?⁠dir:path ‑> unit ‑> t Lwt.t

default ?dir () creates a new default storage (one file per pair)

val set_default : t ‑> unit

Change the storage that is used to evaluate every Maki function

val get_default : unit ‑> t