package lmdb

  1. Overview
  2. Docs

Database with integer keys and string elements.

type t

A handle for an individual database.

type key = int

The key of the database.

type elt = string

The values of the database.

val create : ?create:bool -> Env.t -> string -> t

create env "foo" open the database "foo" in the environment env.

If create is set to true, the database will be created if it doesn't exists. Invalid if env is read only.

  • raises Not_found

    if the database doesn't exist.

val get : t -> key -> elt

get db k returns the value associated to k.

  • raises Not_found

    if the key is not in the database.

val put : ?flags:PutFlags.t -> t -> key -> elt -> unit

put db k v associates the key k to the value v in the database db.

  • parameter flags

    Flags that allow to modify the behavior of put.

val append : t -> key -> elt -> unit

append db k v append k, v at the end of the database db without performing comparisons.

Should only be used to quickly add already-sorted data to the database.

val remove : ?elt:elt -> t -> key -> unit

remove db k removes k from db.

If the database accepts duplicates:

  • if elt is provided, only the specified binding is removed.
  • if elt is not provided, all the bindings with k are removed.
module Txn : sig ... end

A series of operation performed atomically.

module Cursor : sig ... end

Manual iterators.

Misc

val stats : t -> Env.stats
val drop : ?delete:bool -> t -> unit
val compare : t -> key -> key -> int

The comparison function used by the database.

OCaml

Innovation. Community. Security.