AsyncLoadingCache

class AsyncLoadingCache[K, V](val underlying: AsyncLoadingCache[K, V]) extends AsyncCache[K, V]
Companion:
object
class AsyncCache[K, V]
class Object
trait Matchable
class Any

Value members

Concrete methods

def get(key: K): Future[V]

Returns the future associated with key in this cache, obtaining that value from loader if necessary. If the asynchronous computation fails, the entry will be automatically removed.

Returns the future associated with key in this cache, obtaining that value from loader if necessary. If the asynchronous computation fails, the entry will be automatically removed.

Value parameters:
key

key with which the specified value is to be associated

Returns:

the current (existing or computed) future value associated with the specified key

Throws:
java.lang.RuntimeException

or Error if the loader does when constructing the future, in which case the mapping is left unestablished

def getAll(keys: Iterable[K]): Future[Map[K, V]]

Returns the future of a map of the values associated with keys, creating or retrieving those values if necessary. The returned map contains entries that were already cached, combined with newly loaded entries. If the any of the asynchronous computations fail, those entries will be automatically removed.

Returns the future of a map of the values associated with keys, creating or retrieving those values if necessary. The returned map contains entries that were already cached, combined with newly loaded entries. If the any of the asynchronous computations fail, those entries will be automatically removed.

Value parameters:
keys

the keys whose associated values are to be returned

Returns:

the future containing an mapping of keys to values for the specified keys in this cache

Throws:
java.lang.RuntimeException

or Error if the loader does so

override def synchronous(): LoadingCache[K, V]

Returns a view of the entries stored in this cache as a synchronous LoadingCache. A mapping is not present if the value is currently being loaded. Modifications made to the synchronous cache directly affect the asynchronous cache. If a modification is made to a mapping that is currently loading, the operation blocks until the computation completes.

Returns a view of the entries stored in this cache as a synchronous LoadingCache. A mapping is not present if the value is currently being loaded. Modifications made to the synchronous cache directly affect the asynchronous cache. If a modification is made to a mapping that is currently loading, the operation blocks until the computation completes.

Returns:

a thread-safe synchronous view of this cache

Definition Classes
override def toString: String
Definition Classes
Any

Inherited methods

def get(key: K, mappingFunction: K => V): Future[V]

Returns the future associated with key in this cache, obtaining that value from mappingFunction if necessary. This method provides a simple substitute for the conventional "if cached, return; otherwise create, cache and return" pattern.

Returns the future associated with key in this cache, obtaining that value from mappingFunction if necessary. This method provides a simple substitute for the conventional "if cached, return; otherwise create, cache and return" pattern.

Value parameters:
key

key with which the specified value is to be associated

mappingFunction

the function to asynchronously compute a value

Returns:

the current (existing or computed) future value associated with the specified key

Inherited from:
AsyncCache
def getAll(keys: Iterable[K], mappingFunction: Iterable[K] => Map[K, V]): Future[Map[K, V]]

Returns the future of a map of the values associated with keys, creating or retrieving those values if necessary. The returned map contains entries that were already cached, combined with newly loaded entries. If the any of the asynchronous computations fail, those entries will be automatically removed from this cache.

Returns the future of a map of the values associated with keys, creating or retrieving those values if necessary. The returned map contains entries that were already cached, combined with newly loaded entries. If the any of the asynchronous computations fail, those entries will be automatically removed from this cache.

A single request to the mappingFunction is performed for all keys which are not already present in the cache.

Value parameters:
keys

the keys whose associated values are to be returned

mappingFunction

the function to asynchronously compute the values

Returns:

the future containing an unmodifiable mapping of keys to values for the specified keys in this cache

Throws:
java.lang.RuntimeException

or Error if the mappingFunction does when constructing the future, in which case the mapping is left unestablished

Inherited from:
AsyncCache
def getAllFuture(keys: Iterable[K], mappingFunction: Iterable[K] => Future[Map[K, V]]): Future[Map[K, V]]

Returns the future of a map of the values associated with keys, creating or retrieving those values if necessary. The returned map contains entries that were already cached, combined with newly loaded entries. If the any of the asynchronous computations fail, those entries will be automatically removed from this cache.

Returns the future of a map of the values associated with keys, creating or retrieving those values if necessary. The returned map contains entries that were already cached, combined with newly loaded entries. If the any of the asynchronous computations fail, those entries will be automatically removed from this cache.

A single request to the mappingFunction is performed for all keys which are not already present in the cache.

Value parameters:
keys

the keys whose associated values are to be returned

mappingFunction

the function to asynchronously compute the values

Returns:

the future containing an unmodifiable mapping of keys to values for the specified keys in this cache

Throws:
java.lang.RuntimeException

or Error if the mappingFunction does when constructing the future, in which case the mapping is left unestablished

Inherited from:
AsyncCache
def getFuture(key: K, mappingFunction: K => Future[V]): Future[V]

Returns the future associated with key in this cache, obtaining that value from mappingFunction if necessary. This method provides a simple substitute for the conventional "if cached, return; otherwise create, cache and return" pattern.

Returns the future associated with key in this cache, obtaining that value from mappingFunction if necessary. This method provides a simple substitute for the conventional "if cached, return; otherwise create, cache and return" pattern.

Value parameters:
key

key with which the specified value is to be associated

mappingFunction

the function to asynchronously compute a value

Returns:

the current (existing or computed) future value associated with the specified key

Throws:
java.lang.RuntimeException

or Error if the mappingFunction does when constructing the future, in which case the mapping is left unestablished

Inherited from:
AsyncCache
def getIfPresent(key: K): Option[Future[V]]

Returns the future associated with key in this cache, or None if there is no cached future for key.

Returns the future associated with key in this cache, or None if there is no cached future for key.

Value parameters:
key

key whose associated value is to be returned

Returns:

an option containing the current (existing or computed) future value to which the specified key is mapped, or None if this map contains no mapping for the key

Inherited from:
AsyncCache
def put(key: K, valueFuture: Future[V]): Unit

Associates value with key in this cache. If the cache previously contained a value associated with key, the old value is replaced by value. If the asynchronous computation fails, the entry will be automatically removed.

Associates value with key in this cache. If the cache previously contained a value associated with key, the old value is replaced by value. If the asynchronous computation fails, the entry will be automatically removed.

Value parameters:
key

key with which the specified value is to be associated

valueFuture

value to be associated with the specified key

Inherited from:
AsyncCache

Concrete fields

override val underlying: AsyncLoadingCache[K, V]