package phashtbl

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

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

val open_existing : filename -> 'a 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 : 'a t -> unit

close pht closes the previously opened pht.

val mem : 'a t -> 'a -> bool

mem pht key checks if key is bound in pht.

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

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

val replace : 'a t -> 'a -> 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 : 'a t -> 'a -> unit

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

val find : 'a t -> 'a -> string

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

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

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

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

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

OCaml

Innovation. Community. Security.