Module Ocsipersist_lib.Store_json
Parameters
module Functorial : Sigs.FUNCTORIALSignature
type 'a tType of persistent data
type storeData are divided into stores. Create one store for your project, where you will save all your data.
val make_persistent :
store:store ->
name:string ->
json:'a Deriving_Json.t ->
default:'a ->
'a t Lwt.tmake_persistent ~store ~name ~json ~default find a persistent value named name in store store from database, or create it with the default value default if it does not exist. Uses Deriving_Json for type-safe serialisation. An existing value that cannot be deserialised with json is left in place: reading it with get then fails with Ocsipersist_lib.Decoding_error, and the caller decides whether to overwrite it with set.
val make_persistent_lazy :
store:store ->
name:string ->
json:'a Deriving_Json.t ->
default:(unit -> 'a) ->
'a t Lwt.tSame as make_persistent but the default value is evaluated only if needed
val make_persistent_lazy_lwt :
store:store ->
name:string ->
json:'a Deriving_Json.t ->
default:(unit -> 'a Lwt.t) ->
'a t Lwt.tLwt version of make_persistent_lazy.
get pv gives the value of pv. Fails with Ocsipersist_lib.Decoding_error if the stored value cannot be deserialised by the codec pv was opened with.