Evicts the contents of a key
if the old value is value
.
Evicts the contents of a key
if the old value is value
.
Since com.twitter.util.Future uses reference equality, you must use the same object reference to evict a value.
true if the key was evicted false if the key was not evicted
Gets the cached Future.
Gets the cached Future.
None if a value hasn't been specified for that key yet Some(ksync computation) if the value has been specified. Just because this returns Some(..) doesn't mean that it has been satisfied, but if it hasn't been satisfied, it's probably in-flight.
Gets the cached Future, or if it hasn't been returned yet, computes it and returns that value.
Unconditionally sets a value for a given key
the number of results that have been computed successfully or are in flight.
FutureCache is used to represent an in-memory, in-process, asynchronous cache.
Every cache operation is atomic.
Any correct implementation should make sure that you evict failed results, and don't interrupt the underlying request that has been fired off. EvictingCache and Future#interrupting are useful tools for building correct FutureCaches. A reference implementation for caching the results of an asynchronous function can be found at FutureCache$.default.