Module Core_extended.Cache.Make

Parameters

Signature

type ('k, 'v) t

A key value cache

type 'a with_init_args = 'a Store.with_init_args Strat.with_init_args

Used to specify the type of the create and 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.: Store.Table) and the strategy takes an int (eg.: Strategy.Lru) this type will be:

   type 'a with_init_args = int -> 'a
type ('a, 'b) memo = ('a, ('b, exn) Core.Result.tt
val find : ('k'vt ‑> 'k ‑> 'v option
val add : ('k'vt ‑> key:'k ‑> data:'v ‑> unit
val remove : ('k_t ‑> 'k ‑> unit
val clear : (__t ‑> unit
val create : destruct:('v ‑> unit) option ‑> ('k'vt with_init_args
val call_with_cache : cache:('a'bmemo ‑> ('a ‑> 'b) ‑> 'a ‑> 'b
val memoize : ?⁠destruct:('b ‑> unit) ‑> ('a ‑> 'b) ‑> (('a'bmemo * ('a ‑> 'b)) with_init_args