Module Cache

module Cache: Cache

val memoize : ?destruct:('b -> unit) ->
?expire:[ `Keep_all | `Keep_one | `Lru of int ] -> ('a -> 'b) -> 'a -> 'b
memoize ~destruct ~expire f memoizes the results of f.
destruct : function called on every value we remove from the cache
expire : Strategy used to prune out values from the cache
val unit : (unit -> 'a) -> unit -> 'a
Returns memoized version of any function with argument unit. In effect this builds a lazy value.

Exposed cache

These modules implement memoization and give you access to the cache. This, for instance, enables you to flush it.

module Lru: sig .. end
Least recently used caching
module Keep_all: sig .. end
Full caching (never flushes out values automatically )

Generic caching

This enables you to implement your own caching strategy and store.

Generic caching is based on separating the replacement policie and the store and tying them together with Make.

module type Strategy = sig .. end
Replacement policy
module type Store = sig .. end
Caching store
module type S = sig .. end
The output signature of the functor Cache.Make
module Strategy: sig .. end
Predefined strategies
module Store: sig .. end
Predefined stores
module Make: 
functor (Strat : Strategy) ->
functor (Store : Store) -> S with type 'a with_init_args = ('a Store.with_init_args Strat.with_init_args)