| Modifier and Type | Class and Description |
|---|---|
| public abstract static class | ForwardingCache.
A simplified version of |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public ConcurrentMap | asMap()
Implements com. |
| public void | cleanUp()
Implements com. |
| protected abstract Cache | delegate()
Implements abstract com. |
| public V | get(K key, Callable<? extends V> valueLoader)
Implements com. key in this cache, obtaining that value from loader if necessary.
|
| public ImmutableMap | getAllPresent(Iterable<? extends Object> keys)
Implements com. keys in this cache.
|
| public V | getIfPresent(Object key)
Implements com. key in this cache, or null if there is no
cached value for key.
|
| public void | invalidate(Object key)
Implements com. key.
|
| public void | invalidateAll(Iterable<? extends Object> keys)
Implements com. keys.
|
| public void | invalidateAll()
Implements com. |
| public void | put(K key, V value)
Implements com. value with key in this cache.
|
| public void | putAll(Map<? extends K, ? extends V> m)
Implements com. |
| public long | size()
Implements com. |
| public CacheStats | stats()
Implements com. |
| ForwardingCache | back to summary |
|---|---|
| protected ForwardingCache() Constructor for use by subclasses. | |
| asMap | back to summary |
|---|---|
| public ConcurrentMap Implements com. Doc from com. Returns a view of the entries stored in this cache as a thread-safe map. Modifications made to the map directly affect the cache. Iterators from the returned map are at least weakly consistent: they are safe for concurrent use, but if the cache is modified (including by eviction) after the iterator is created, it is undefined which of the changes (if any) will be reflected in that iterator.
| |
| cleanUp | back to summary |
|---|---|
| public void cleanUp() Implements com. Doc from com. Performs any pending maintenance operations needed by the cache. Exactly which activities are performed -- if any -- is implementation-dependent.
| |
| delegate | back to summary |
|---|---|
| protected abstract Cache Implements abstract com. Doc from com. Returns the backing delegate instance that methods are forwarded to. Abstract subclasses
generally override this method with an abstract method that has a more specific return type,
such as
| |
| get | back to summary |
|---|---|
| public V get(K key, Callable<? extends V> valueLoader) throws ExecutionException Implements com. Doc from com. Returns the value associated with Among the improvements that this method and
Among the further improvements that
Warning For any given key, every Warning as with No observable state associated with this cache is modified until loading completes.
| |
| getAllPresent | back to summary |
|---|---|
| public ImmutableMap Implements com. Doc from com. Returns a map of the values associated with
| |
| getIfPresent | back to summary |
|---|---|
| public V getIfPresent(Object key) Implements com. Doc from com. Returns the value associated with
| |
| invalidate | back to summary |
|---|---|
| public void invalidate(Object key) Implements com. Doc from com. Discards any cached value for key
| |
| invalidateAll | back to summary |
|---|---|
| public void invalidateAll(Iterable<? extends Object> keys) Implements com. Doc from com. Discards any cached values for keys
| |
| invalidateAll | back to summary |
|---|---|
| public void invalidateAll() Implements com. Doc from com. Discards all entries in the cache.
| |
| put | back to summary |
|---|---|
| public void put(K key, V value) Implements com. Doc from com. Associates Prefer
| |
| putAll | back to summary |
|---|---|
| public void putAll(Map<? extends K, ? extends V> m) Implements com. Doc from com. Copies all of the mappings from the specified map to the cache. The effect of this call is
equivalent to that of calling
| |
| size | back to summary |
|---|---|
| public long size() Implements com. Doc from com. Returns the approximate number of entries in this cache.
| |
| stats | back to summary |
|---|---|
| public CacheStats stats() Implements com. Doc from com. Returns a current snapshot of this cache's cumulative statistics, or a set of default values if the cache is not recording statistics. All statistics begin at zero and never decrease over the lifetime of the cache. Warning this cache may not be recording statistical data. For example, a cache
created using
| |
ForwardingCache where subclasses can pass in an already
constructed Cache as the delegate.
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected final Cache | delegate()
Implements abstract com. |
| delegate | back to summary |
|---|---|
| private final Cache<K, V> delegate | |
| SimpleForwardingCache | back to summary |
|---|---|
| protected SimpleForwardingCache(Cache<K, V> delegate) | |
| delegate | back to summary |
|---|---|
| protected final Cache Implements abstract com. Doc from com. Returns the backing delegate instance that methods are forwarded to. Abstract subclasses
generally override this method with an abstract method that has a more specific return type,
such as
| |