module type S =sig
..end
Cache.Make
type ('k, 'v)
t
type 'a
with_init_args
Cache.S.create
and Cache.S.memoize
function. This
describes the arguments required to initialise the caching strategy and
the store. For instance if the store doesn't take any argument (eg.:
Cache.Store.Table
) and the strategy takes an int
(eg.: Cache.Strategy.Lru
)
this type will be:
type 'a with_init_args = int -> 'a
type('a, 'b)
memo =('a, ('b, exn) Core.Std.Result.t) t
val find : ('k, 'v) t -> 'k -> 'v option
val add : ('k, 'v) t -> key:'k -> data:'v -> unit
val remove : ('k, 'a) t -> 'k -> unit
val clear : ('a, 'b) t -> unit
val create : destruct:('v -> unit) option -> ('k, 'v) t with_init_args
val call_with_cache : cache:('a, 'b) memo -> ('a -> 'b) -> 'a -> 'b
val memoize : ?destruct:('b -> unit) ->
('a -> 'b) -> (('a, 'b) memo * ('a -> 'b)) with_init_args