Computes or retrieves the value corresponding to key
.
Computes or retrieves the value corresponding to key
.
the non-null key whose value should be loaded
the value associated with key
; must not be null
Exception
if unable to load the result
InterruptedException
if this method is interrupted. InterruptedException is
treated like any other Exception in all respects except that, when it is caught,
the thread's interrupt status is set
Computes or retrieves the value corresponding to key
.
Computes or retrieves the value corresponding to key
. Simply forwards
to load(K)
.
Computes or retrieves the values corresponding to keys
.
Computes or retrieves the values corresponding to keys
. This method is called by
LoadingCache#getAll
.
If the returned map doesn't contain all requested keys
then the entries it does
contain will be cached, but getAll
will throw an exception. If the returned map
contains extra keys not present in keys
then all returned entries will be cached,
but only the entries for keys
will be returned from getAll
.
This method should be overridden when bulk retrieval is significantly more efficient than
many individual lookups. Note that LoadingCache#getAll
will defer to individual calls
to LoadingCache#get
if this method is not overridden.
the unique, non-null keys whose values should be loaded
an immutable map from each key in keys
to the value associated with that key;
may not contain null values
Exception
if unable to load the result
InterruptedException
if this method is interrupted. InterruptedException is
treated like any other Exception in all respects except that, when it is caught,
the thread's interrupt status is set
Computes or retrieves a replacement value corresponding to an already-cached key
.
Computes or retrieves a replacement value corresponding to an already-cached key
. This
method is called when an existing cache entry is refreshed by
CacheBuilder#refreshAfterWrite
, or through a call to LoadingCache#refresh
.
This implementation synchronously delegates to #load
. It is recommended that it be
overridden with an asynchronous implementation when using
CacheBuilder#refreshAfterWrite
.
Note: all exceptions thrown by this method will be logged and then swallowed.
the non-null key whose value should be loaded
the non-null old value corresponding to key
the future new value associated with key
;
must not be null, must not return null
Exception
if unable to reload the result
InterruptedException
if this method is interrupted. InterruptedException
is
treated like any other Exception
in all respects except that, when it is caught,
the thread's interrupt status is set
Computes or retrieves values, based on a key, for use in populating a LoadingCache.
This class should be when bulk retrieval is significantly more efficient than many individual lookups. Otherwise the
CacheLoader
companion object can be used to create aCacheLoader[K,V]
from a functionK => V
. For exampleAlternatively the function
K => V
can be passed to CacheBuilder directly.0.7 (copied from Guava-libraries)