Legend:
Library
Module
Module type
Parameter
Class
Class type
A Mutable structure akin to a set, but with a size bound. Note that, different caches have different policies towards the size bounds: some uphold the bound strictly, some treat the bound as a suggestion. In addition, some caches count their elements somewhat sloppily.
In general, the caches of ringo are intended to be used in settings that do not require strict, by-the-number, extremely-predictable behaviors.
add c v adds the value v to the cache c. This may or may not cause another element to be removed from the cache, depending on the number of elements already present in the cache c, the size-bound of the cache c, and the policy of the cache c towards its size-bound.
If v is already present in c, the element may count twice towards the size bound for some time. In other words: apart for size bound in some cases, the following sequences of operations are indistinguishable: add c v; add c u and add c v; remove c v; add c u
mem c v is true if v is present in c. It is false otherwise.
Note that the in caches with a non-FIFO replacement policy, this may have a side effect on the v element. Specifically, in those caches, it might make it less likely to be removed when supernumerary elements are inserted.