Module Util.Lru_ss

A mutable Lru for string->string map; at the moment this does not record negative information (this key is not present) but perhaps it should FIXME

module K : sig ... end
module V : sig ... end

NOTE a mutable Lru; you have to call trim explicitly

include sig ... end
type t = Lru.M.Make(K)(V).t
type k = K.t
type v = V.t
val create : ?⁠random:bool -> int -> t
val is_empty : t -> bool
val size : t -> int
val weight : t -> int
val capacity : t -> int
val resize : int -> t -> unit
val trim : t -> unit
val mem : k -> t -> bool
val find : k -> t -> v option
val promote : k -> t -> unit
val add : k -> v -> t -> unit
val remove : k -> t -> unit
val lru : t -> (k * v) option
val drop_lru : t -> unit
val fold : (k -> v -> 'a -> 'a) -> 'a -> t -> 'a
val iter : (k -> v -> unit) -> t -> unit
val of_list : (k * v) list -> t
val to_list : t -> (k * v) list
val pp : ?⁠pp_size:(Stdlib.Format.formatter -> (int * int) -> unit) -> ?⁠sep:(Stdlib.Format.formatter -> unit -> unit) -> (Stdlib.Format.formatter -> (k * v) -> unit) -> Stdlib.Format.formatter -> t -> unit
val pp_dump : (Stdlib.Format.formatter -> k -> unit) -> (Stdlib.Format.formatter -> v -> unit) -> Stdlib.Format.formatter -> t -> unit
type tbl = (string, [ `Insert of string | `Delete ]) Stdlib.Hashtbl.t
val batch_adjust : t -> tbl -> unit

Adjust the Lru, given a recent set of operations; assuming the lru is small wrt. the operations, we just loop through the lru updating any values that have been updated by the operations; new operations do not get added automatically; we do not trim