Module Lru


module Lru: sig .. end
Least Recently Used cache

Simple LRU list for use in caching situations. The LRU is designed to not blow up when the destructor throws an exception, but better not to try...


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
val clear : 'a lru -> unit
val size : 'a lru -> int
val change_size : 'a lru -> int -> unit
val in_cache : 'a -> 'a lru -> bool
val memoize : ?destruct:('a -> unit) -> int -> ('b -> 'a) -> 'b lru * ('b -> 'a)