Drup/ocaml-lmdb

Ocaml bindings for lmdb.

50

stars

145

commits

C

primary language

Aug 30, 2026

updated

drup.github.io/ocaml-lmdb/dev/
ctypes
database
lmdb
ocaml

README

OCaml-lmdb Build Status docs

The LMDB database is a fast in-file database that supports ACID transactions.

These bindings expose a typesafe yet low-overhead API. Both transactions and cursors are available. Database implementations are specialized both by keys and values. Two module are predefined: Lmdb.Db (string keys and string values) and Lmdb.IntDb (int keys and string values). New implementation (which can use special LMDB features such as multi-values) can be added via a functorial interface.

Please consult the documentation and a simple example.

let open Lmdb in
let env = Env.(create Rw ~flags:Flags.no_subdir ~max_maps:1) "mydb" in
let map = Map.create Nodup ~key:Conv.string ~value:Conv.string
	    ~name:"Camelidae" env in
Map.add map "Bactrian camel" "Elegant and beautiful animal with two humps."

Contributors

Drup

75 commits

madroach

63 commits

toots

4 commits

Alizter

2 commits

Drup/ocaml-lmdb

Ocaml bindings for lmdb.

50

stars

145

commits

C

primary language

Aug 30, 2026

updated

drup.github.io/ocaml-lmdb/dev/
ctypes
database
lmdb
ocaml

README

OCaml-lmdb Build Status docs

The LMDB database is a fast in-file database that supports ACID transactions.

These bindings expose a typesafe yet low-overhead API. Both transactions and cursors are available. Database implementations are specialized both by keys and values. Two module are predefined: Lmdb.Db (string keys and string values) and Lmdb.IntDb (int keys and string values). New implementation (which can use special LMDB features such as multi-values) can be added via a functorial interface.

Please consult the documentation and a simple example.

let open Lmdb in
let env = Env.(create Rw ~flags:Flags.no_subdir ~max_maps:1) "mydb" in
let map = Map.create Nodup ~key:Conv.string ~value:Conv.string
	    ~name:"Camelidae" env in
Map.add map "Bactrian camel" "Elegant and beautiful animal with two humps."

Contributors

Drup

75 commits

madroach

63 commits

toots

4 commits

Alizter

2 commits

Languages

C

81.2%

OCaml

17.3%

Makefile

1.0%