Up

Module Memo (Key : Core.Std.Hashable)

Parameters

Signature

val memo : (Key.t -> ('a, 'e) t) -> Key.t -> ('a, 'e) t

memo f is similar to Core.Std.Memo.general (fun k -> shared (f k)). The important difference is that the memo entry is only kept while the resource is acquired. In particular, once all handles of a particular key get released the memo entry gets forgotten and f gets applied again on next acquisition. If acquire fails or function raises for a particular key, the result is not cached.