package phashtbl

  1. Overview
  2. Docs

Module Phashtbl.GenKeyToGenValSource

Sourcetype ('a, 'b) t
Sourceval open_new : filename -> ('a, 'b) t

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

Sourceval open_existing : filename -> ('a, 'b) t

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

Sourceval close : ('a, 'b) t -> unit

close pht closes the previously opened pht.

Sourceval mem : ('a, 'b) t -> 'a -> bool

mem pht key checks if key is bound in pht.

Sourceval add : ('a, 'b) t -> 'a -> 'b -> unit

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

Sourceval replace : ('a, 'b) t -> 'a -> 'b -> 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.

Sourceval remove : ('a, 'b) t -> 'a -> unit

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

Sourceval find : ('a, 'b) t -> 'a -> 'b

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

Sourceval iter : ('a -> 'b -> unit) -> ('a, 'b) t -> unit

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

Sourceval fold : ('a -> 'b -> 'c -> 'c) -> ('a, 'b) t -> 'c -> 'c

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