BlockingCache

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.

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

Link copied to clipboard

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.

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.

Link copied to clipboard
fun expireAll()

Tells the cache that all values are out-of-date, and should be queried again the next time they are requested.

Link copied to clipboard
operator fun get(id: Identifier): Outcome<Failure, Value>

Gets the value associated with id in the cache, at the current time.

Link copied to clipboard

Convenience function to access a value from InfallibleCache that are blocking.

Link copied to clipboard
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.

Link copied to clipboard
fun update(vararg values: Pair<Identifier, Value>): <Error class: unknown class>

Forces the cache to accept the given values as more recent than their associated identifier than whatever was previously stored.