package ocsigenserver
Install
Dune Dependency
Authors
Maintainers
Sources
md5=5ea779e418bf936d7301057d6d95011c
sha512=e27b9ad71ac2bd0e817ff35b66de606ffabd5b71b88b34974cbf41181e5a824767616fdd2b7908539bdd394c0873aaacdc7768f6dc7ad3f9dc33e8eb1a6f9fa6
doc/ocsipersistpgsql/Ocsipersist/index.html
Module Ocsipersist
Source
Persistent data on hard disk.
There are currently three implementations of this module, one using a DBM database, on the PostgreSQL database, and one using SQLITE. Link the one your want with your program.
Persistent references
When launching the program, if the value exists on hard disk, it is loaded, otherwise it is initialised to the default value
Type of persistent data
Data are divided into stores. Create one store for your project, where you will save all your data.
make_persistent store name 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.
Same as make_persistent but the default value is evaluated only if needed
val make_persistent_lazy_lwt :
store:store ->
name:string ->
default:(unit -> 'a Lwt.t) ->
'a t Lwt.t
Lwt version of make_persistent_lazy.
Persistent tables
Type of persistent table
Open a table (and create it if it does not exist)
find table key
gives the value associated to key
. Fails with Not_found
if not found.
add table key value
associates value
to key
. If the database already contains data associated with key
, that data is discarded and silently replaced by the new data.
replace_if_exists table key value
associates value
to key
only if key
is already bound. If the database does not contain any data associated with key
, fails with Not_found
.
remove table key
removes the entry in the table if it exists
Important warning: this iterator may not iter on all data of the table if another thread is modifying it in the same time. Nonetheless, it should not miss more than a very few data from time to time, except if the table is very old (at least 9 223 372 036 854 775 807 insertions).
Legacy interface for iter_step
Important warning: this iterator may not iter on all data of the table if another thread is modifying it in the same time. Nonetheless, it should not miss more than a very few data from time to time, except if the table is very old (at least 9 223 372 036 854 775 807 insertions).