[ANN] New release of Ocsipersist

Ocsipersist has been recently updated.

Ocsipersist is an OCaml interface for key-value stores, with three implementations based on SQLite, DBM and PostgreSQL.

It proposes several interfaces: basic string to string tables, typed tables with custom (de)serialisation functions, persistent variables …

This new version 2.0.0, adds the following features:

  • some dependencies removed
  • Basic interface for persistent references, in the style of Eliom’s scoped references (but without scope)

Example of use of persistent references from the toplevel, with the SQLite backend:

# #require "lwt_ppx";;
(* #thread;; if you are using OCaml < 5.0.0 *)
# #require "ocsipersist-sqlite";;
# Ocsipersist.init ();;
# let r = Ocsipersist.Ref.ref ~persistent:"r" 444;;
val r : int Ocsipersist.Ref.t = <abstr>
# Lwt_main.run (let%lwt v = Ocsipersist.Ref.get r in print_int v; Lwt.return_unit);;
444- : unit = ()

Backends:
Choose the backend you prefer by using packages ocsipersist-sqlite, ocsipersist-dbm or ocsipersist-postgresql.

Configuration:

  • Use module Ocsipersist_settings, provided by each backend to configure the database
  • Opam packages ocsipersist-sqlite-config, ocsipersist-dbm-config or ocsipersist-postgresql-config make it possible to configure the backend from Ocsigen Server’s config file (breaking change: this was provided by ocsipersist-sqlite, ocsipersist-dbm or ocsipersist-postgresql before. You’ll need to update your configuration files).
10 Likes