123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657open!CoremoduletypeH=sigtypetincludeHashtbl.Key_plainwithtypet:=tincludeInvariant.Swithtypet:=tendmoduletypeS=sigtypekeytype'at[@@derivingsexp_of](** Creates an LRU cache.
[destruct] is called on all elements removed from the cache, both implicilty (e.g.
[set]) or explicitly (e.g. [remove], [clear]). [destruct] may raise; the exceptions
pass through to the caller of the operation that triggered the removal. *)valcreate:?destruct:((key*'a)Queue.t->unit)->max_size:int->unit->'at(** Ordered from least- to most-recently used elements. *)valto_alist:'at->(key*'a)listvallength:_t->intvalis_empty:_t->boolvalstats:?sexp_of_key:(key->Sexp.t)->_t->Sexp.tvalmax_size:_t->int(** [hit_rate] is the ratio of calls to [mem], [find], and similar functions that
queried for a key that was in the cache. *)valhit_rate:_t->floatincludeInvariant.S1withtype'at:='at(** [mem] and [find] are considered as uses of the key, thus these operation refresh
the priority of the key for the computation of the lru heuristic. *)valmem:_t->key->boolvalfind:'at->key->'aoption(** Write operations on the [t] may drop some of the least recently used elements if the
size exceeds the maximum size authorized. *)valclear:_t->[`Droppedofint]valset_max_size:_t->max_size:int->[`Droppedofint]valremove:_t->key->[`Ok|`No_such_key]valset:'at->key:key->data:'a->unitvalfind_or_add:'at->key->default:(unit->'a)->'avalfind_and_remove:'at->key->'aoptionendmoduletypeLru_cache=sigmoduletypeS=SmoduletypeH=HmoduleMake(H:H):Swithtypekey=H.tend