BlockingCache¶
class BlockingCache<Identifier, Failure, Value>
A blocking cache implementation.
Unlike asynchronous caches, this implementation doesn't allow subscribing to a value to see it change over time.
To instantiate this class, see the blocking helper.
Type Parameters¶
-
Identifier: An identifier representing a cached object.
-
Failure: A cache value that represents a failure.
-
Value: A cache value that represents a success.
Functions¶
expire¶
fun expire(id: Identifier)
Tells the cache that the value it stores for id is out-of-date, and should be queried again the next time it is requested.
For more information, see Cache.expire.
fun expire(ids: Collection<Identifier>)
Tells the cache that the value it stores for the given ids are out-of-date, and should be queried again next time they are requested.
For more information, see Cache.expire.
expireAll¶
fun expireAll()
Tells the cache that all values are out-of-date, and should be queried again the next time they are requested.
For more information, see Cache.expireAll.
get¶
operator fun get(id: Identifier): Outcome<Failure, Value>
getValue¶
fun <Identifier, Value> BlockingCache<Identifier, Nothing, Value>.getValue(id: Identifier): Value
fun <Identifier, Context, Value> BlockingContextualCache<Identifier, Context, Nothing, Value>.getValue(id: Identifier, context: Context): Value
Convenience function to access a value from infallible caches that are blocking.
For more information, see BlockingCache.get and Cache.get.
set¶
operator fun set(id: Identifier, value: Value)
Forces the cache to accept value as a more recent value for the given id than whatever it was previously storing.
For more information, see Cache.update.
update¶
fun update(values: Collection<Pair<Identifier, Value>>)
fun update(vararg values: Pair<Identifier, Value>)
Forces the cache to accept the given values as more recent than their associated identifier than whatever was previously stored.
For more information, see Cache.update.