package phashtbl

  1. Overview
  2. Docs
type t
val open_new : filename -> t

open_new filename creates a new persistent hashtbl. dbm will create filename.dir and filename.pag files.

val open_existing : filename -> t

open_existing filename opens an existing persistent hashtbl for reading and writing. The files filename.dir and filename.pag must already exist.

val close : t -> unit

close pht closes the previously opened pht.

val mem : t -> string -> bool

mem pht key checks if key is bound in pht.

val add : t -> string -> string -> unit

add pht key value binds key to value in pht. Raises Dbm_error if key is already bound in pht.

val replace : t -> string -> string -> unit

replace pht key value binds key to value in pht. If pht already contains a binding for key, that previous binding is discarded and replaced by value.

val remove : t -> string -> unit

remove pht key removes key and its bound value from pht. If key is unbound in pht, raises Dbm_error.

val find : t -> string -> string

find pht key finds the value bound to key in pht or raises Not_found if key is unbound.

val iter : (string -> string -> unit) -> t -> unit

iter f pht calls f key value on each (key, value) binding from pht.

val fold : (string -> string -> 'c -> 'c) -> t -> 'c -> 'c

fold f pht init folds f over pht with init as the initial accumulator.