Module Batteries_uni.Cache


module Cache: BatCache


type ('a, 'b) manual_cache = {
   get : 'a -> 'b;
   del : 'a -> unit;
   enum : unit -> ('a * 'b) BatEnum.t;
}
val make_ht : gen:('a -> 'b) -> int -> ('a, 'b) manual_cache
val make_map : gen:('a -> 'b) -> ('a, 'b) manual_cache
These functions build a cache with either a hashtbl or a map. The cache.get function gets a value from the cache, generating it with the generator function gen and adding it to the cache if needed. The cache.del function removes a value from the cache.
type ('a, 'b) auto_cache = 'a -> 'b 
val lru_cache : gen:('a -> 'b) -> int -> ('a, 'b) auto_cache