Page
Library
Module
Module type
Parameter
Class
Class type
Source
Lru_cache.Make
SourceCreates 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.
hit_rate
is the ratio of calls to mem
, find
, and similar functions that queried for a key that was in the cache.
include Core.Invariant.S1 with type 'a t := 'a t
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.
Write operations on the t
may drop some of the least recently used elements if the size exceeds the maximum size authorized.