Cache interface to minimize the
effort required to implement this interface.
To implement a cache, the programmer needs only to extend this class and provide an
implementation for the get(Object) and getIfPresent methods. getUnchecked, get(Object, Callable), and getAll are implemented in terms of
get; getAllPresent is implemented in terms of getIfPresent; putAll is implemented in terms of put, invalidateAll(Iterable) is implemented
in terms of invalidate. The method cleanUp is a no-op. All other methods throw
an UnsupportedOperationException.
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public final V | apply(K
the function argument key)Implements com. |
| public ImmutableMap | getAll(Iterable<? extends K> keys)
Implements com. keys, creating or retrieving those values
if necessary.
|
| public V | getUnchecked(K key)
Implements com. key in this cache, first loading that value if
necessary.
|
| public void | refresh(K key)
Implements com. key, possibly asynchronously.
|
| AbstractLoadingCache | back to summary |
|---|---|
| protected AbstractLoadingCache() Constructor for use by subclasses. | |
| apply | back to summary |
|---|---|
| public final V apply(K key) Implements com. Doc from java. Applies this function to the given argument.
| |
| getAll | back to summary |
|---|---|
| public ImmutableMap Implements com. Doc from com. Returns a map of the values associated with Caches loaded by a Note that duplicate elements in
| |
| getUnchecked | back to summary |
|---|---|
| public V getUnchecked(K key) Implements com. Doc from com. Returns the value associated with If another call to Caches loaded by a Warning this method silently converts checked exceptions to unchecked exceptions,
and should not be used with cache loaders which throw checked exceptions. In such cases use
| |
| refresh | back to summary |
|---|---|
| public void refresh(K key) Implements com. Doc from com. Loads a new value for Caches loaded by a Returns without doing anything if another thread is currently loading the value for
| |