`sig
val memoize :
?destruct:('b -> unit) ->
?expire:[ `Keep_all | `Keep_one | `Lru of int ] -> ('a -> 'b) -> 'a -> 'b
val unit : (unit -> 'a) -> unit -> 'a
module Lru :
sig
type ('k, 'v) t
type ('a, 'b) memo = ('a, ('b, exn) Core.Std.Result.t) Cache.Lru.t
val find : ('k, 'v) Cache.Lru.t -> 'k -> 'v option
val add : ('k, 'v) Cache.Lru.t -> key:'k -> data:'v -> unit
val remove : ('k, 'a) Cache.Lru.t -> 'k -> unit
val clear : ('a, 'b) Cache.Lru.t -> unit
val create :
destruct:('v -> unit) option -> int -> ('k, 'v) Cache.Lru.t
val call_with_cache :
cache:('a, 'b) Cache.Lru.memo -> ('a -> 'b) -> 'a -> 'b
val memoize :
?destruct:('b -> unit) ->
('a -> 'b) -> int -> ('a, 'b) Cache.Lru.memo * ('a -> 'b)
end
module Keep_all :
sig
type ('k, 'v) t
type ('a, 'b) memo = ('a, ('b, exn) Core.Std.Result.t) Cache.Keep_all.t
val find : ('k, 'v) Cache.Keep_all.t -> 'k -> 'v option
val add : ('k, 'v) Cache.Keep_all.t -> key:'k -> data:'v -> unit
val remove : ('k, 'a) Cache.Keep_all.t -> 'k -> unit
val clear : ('a, 'b) Cache.Keep_all.t -> unit
val create : destruct:('v -> unit) option -> ('k, 'v) Cache.Keep_all.t
val call_with_cache :
cache:('a, 'b) Cache.Keep_all.memo -> ('a -> 'b) -> 'a -> 'b
val memoize :
?destruct:('b -> unit) ->
('a -> 'b) -> ('a, 'b) Cache.Keep_all.memo * ('a -> 'b)
end
module type Strategy =
sig
type 'a t
type 'a with_init_args
val cps_create :
f:('a Cache.Strategy.t -> 'b) -> 'b Cache.Strategy.with_init_args
val touch : 'a Cache.Strategy.t -> 'a -> 'a list
val remove : 'a Cache.Strategy.t -> 'a -> unit
val clear : 'a Cache.Strategy.t -> unit
end
module type Store =
sig
type ('k, 'v) t
type 'a with_init_args
val cps_create :
f:(('a, 'c) Cache.Store.t -> 'b) -> 'b Cache.Store.with_init_args
val clear : ('k, 'v) Cache.Store.t -> unit
val replace : ('k, 'v) Cache.Store.t -> key:'k -> data:'v -> unit
val find : ('k, 'v) Cache.Store.t -> 'k -> 'v option
val data : ('a, 'v) Cache.Store.t -> 'v list
val remove : ('k, 'v) Cache.Store.t -> 'k -> unit
end
module type S =
sig
type ('k, 'v) t
type 'a with_init_args
type ('a, 'b) memo = ('a, ('b, exn) Core.Std.Result.t) Cache.S.t
val find : ('k, 'v) Cache.S.t -> 'k -> 'v option
val add : ('k, 'v) Cache.S.t -> key:'k -> data:'v -> unit
val remove : ('k, 'a) Cache.S.t -> 'k -> unit
val clear : ('a, 'b) Cache.S.t -> unit
val create :
destruct:('v -> unit) option ->
('k, 'v) Cache.S.t Cache.S.with_init_args
val call_with_cache :
cache:('a, 'b) Cache.S.memo -> ('a -> 'b) -> 'a -> 'b
val memoize :
?destruct:('b -> unit) ->
('a -> 'b) ->
(('a, 'b) Cache.S.memo * ('a -> 'b)) Cache.S.with_init_args
end
module Strategy :
sig
module Lru :
sig
type 'a t
type 'a with_init_args = int -> 'a
val cps_create : f:('a t -> 'b) -> 'b with_init_args
val touch : 'a t -> 'a -> 'a list
val remove : 'a t -> 'a -> unit
val clear : 'a t -> unit
end
module Keep_all :
sig
type 'a t
type 'a with_init_args = 'a
val cps_create : f:('a t -> 'b) -> 'b with_init_args
val touch : 'a t -> 'a -> 'a list
val remove : 'a t -> 'a -> unit
val clear : 'a t -> unit
end
end
module Store :
sig
module Table :
sig
type ('k, 'v) t
type 'a with_init_args = 'a
val cps_create : f:(('a, 'c) t -> 'b) -> 'b with_init_args
val clear : ('k, 'v) t -> unit
val replace : ('k, 'v) t -> key:'k -> data:'v -> unit
val find : ('k, 'v) t -> 'k -> 'v option
val data : ('a, 'v) t -> 'v list
val remove : ('k, 'v) t -> 'k -> unit
end
end
module Make :
functor (Strat : Strategy) (Store : Store) ->
sig
type ('k, 'v) t
type 'a with_init_args = 'a Store.with_init_args Strat.with_init_args
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
end
end`