Ringo

Caches (bounded-size, key-value or simple-value stores) and other bounded-size collections.

Cache

A map-cache (Sigs.CACHE_MAP) (resp. a set-cache, Sigs.CACHE_SET) is a module that implements an imperative, key-value (resp. value) store.

A cache is bounded in size – meaning that inserting bindings (resp. elements) beyond the cache capacity removes other bindings (resp. elements).

The specific behaviour of the cache is controlled by different options. Specifically, the replacement policy (which bindings (resp. elements) are removed when supernumerary bindings (resp. elements) are inserted), the overflow policy (when are bindings (resp. elements) removed), the accounting policy (how precisely are bindings (resp. elements) counted), and the capacity (how many bindings (resp. elements) a cache can hold), are all controlled by parameters.

Cache parameters

Lwt, Option and Result wrappers

The package ringo-lwt includes wrappers for making Ringo map-caches friendly to Lwt. Specifically, it includes a functor that, given a map-cache, will produce a new cache with the following features:

Two further functors provide integration for Lwt-and-Option (wherein promises resolving to None are also removed) and Lwt-and-Result (wherein promises resolving to Error are also removed).

These additional abstractions help avoiding race conditions.

Ring, Dll

Both rings and dlls are bounded-size imperative collections. Unlike caches, their interface is much simpler: essentially providing add and remove.

They are used internally to implement some components of the caches. They are exposed because they can be useful.