Module Data.ConcurrentHashmap

A lock free concurrency safe hashmap

Parameters

module H : Batteries.Hashtbl.HashedType
module D : DefaultType
module HM : Batteries.Hashtbl.S with type key = H.t

Signature

type key = H.t
type value = D.t Stdlib.Atomic.t
type t
val create : unit -> t
val to_list : t -> (key * value) list
val to_seq : t -> (key * value) Batteries.Seq.t
val to_seq_values : t -> value Batteries.Seq.t
val to_hashtbl : t -> D.t HM.t
val find_option : t -> key -> value option
val find : t -> key -> value

find t k returns the value associated with k in t. If k is not present, it raises Not_found. Use this method if you expect the value to be present in the hashmap

val mem : t -> key -> bool
val find_create : t -> key -> value * bool

find_create t k returns the value associated with k in t. If k is not present, it creates a new value using the default factory and adds it to t. It returns the new value and a boolean indicating whether it was created.