Returns either the cached Future for the given key or evaluates the given value generating
function producing a Future[V]
.
Returns either the cached Future for the given key or evaluates the given value generating
function producing a Future[V]
.
Selects the (potentially non-existing) cache entry with the given key.
Selects the (potentially non-existing) cache entry with the given key.
Returns a snapshot view of the keys as an iterator, traversing the keys from the least likely to be retained to the most likely.
Returns a snapshot view of the keys as an iterator, traversing the keys from the least likely to be retained to the most likely. Note that this is not constant time.
No more than limit keys will be returned
Clears the cache by removing all entries.
Clears the cache by removing all entries.
Retrieves the future instance that is currently in the cache for the given key.
Retrieves the future instance that is currently in the cache for the given key. Returns None if the key has no corresponding cache entry.
Returns the set of keys in the cache, in no particular order Should return in roughly constant time.
Returns the set of keys in the cache, in no particular order Should return in roughly constant time. Note that this number might not reflect the exact keys of active, unexpired cache entries, since expired entries are only evicted upon next access (or by being thrown out by a capacity constraint).
Removes the cache item for the given key.
Removes the cache item for the given key. Returns the removed item if it was found (and removed).
Returns the upper bound for the number of currently cached entries.
Returns the upper bound for the number of currently cached entries. Note that this number might not reflect the exact number of active, unexpired cache entries, since expired entries are only evicted upon next access (or by being thrown out by a capacity constraint).
A thread-safe implementation of eu.shiftforward.apso.caching.Cache. The cache has a defined maximum number of entries it can store. After the maximum capacity is reached new entries cause old ones to be evicted in a last-recently-used manner, i.e. the entries that haven't been accessed for the longest time are evicted first.