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 spray.caching.cache. The cache has a defined maximum number of entries is can store. After the maximum capacity has been 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. In addition this implementation optionally supports time-to-live as well as time-to-idle expiration. The former provides an upper limit to the time period an entry is allowed to remain in the cache while the latter limits the maximum time an entry is kept without having been accessed. If both values are non-zero the time-to-live has to be strictly greater than the time-to-idle. Note that expired entries are only evicted upon next access (or by being thrown out by the capacity constraint), so they might prevent gargabe collection of their values for longer than expected.