Module Std.Lru


module Lru: Lru

type 'a lru 
val create : int -> ('a -> unit) -> 'a lru
create size destructor creates a new lru list that stores at most size elements, and calls destructor on any element before it's kicked out of the list
val touch : 'a lru -> 'a -> unit
touch marks an element as being recently used, and updates the LRU accordingly. An element does not have to be in the LRU to be touched.
val clear : 'a lru -> unit
clears out the entire lru, calling the destructor in each element
val size : 'a lru -> int
returns current size of lru
val change_size : 'a lru -> int -> unit
change the maximum size of the LRU list. If the size goes down, this could cause a series of destructor calls.
val in_cache : 'a -> 'a lru -> bool
tells you whether a given value is cached or not
val memoize : ?destruct:('a -> unit) -> int -> ('b -> 'a) -> 'b lru * ('b -> 'a)
Returns lru list and memoized version of function.