Module Prime_beacon

Memory cache management for weak references (prime.unstable).

Beacons can be used in conjunction with weak arrays or weak hash tables to implement memory caching schemes. The beacon itself just prevent an object from being garbage-collected while it is actively accessed. It does so by hooking beacons onto a global list which is filtered after each major GC.

module type S = sig ... end
module type CACHE_METRIC = sig ... end
module Make : functor (M : CACHE_METRIC) -> S

Create a beacon API for based on the given metrics. The resulting module contains globals and registers a Gc.alarm, so it is recommended to use a single or a few global instances.