get(Object, Callable) or put(Object, Object), and are stored in the cache until either
evicted or manually invalidated. The common way to build instances is using CacheBuilder.
Implementations of this interface are expected to be thread-safe, and can be safely accessed by multiple concurrent threads.
| Modifier and Type | Method and Description |
|---|---|
| public ConcurrentMap | |
| public void | |
| public V | |
| public ImmutableMap | getAllPresent(Iterable<? extends Object> keys)
Returns a map of the values associated with |
| public V | getIfPresent(Object key)
Returns the value associated with |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public long | |
| public CacheStats | stats()
Returns a current snapshot of this cache's cumulative statistics, or a set of default values if the cache is not recording statistics. |
| asMap | back to summary |
|---|---|
| public ConcurrentMap 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() Performs any pending maintenance operations needed by the cache. Exactly which activities are performed -- if any -- is implementation-dependent. | |
| get | back to summary |
|---|---|
| public V get(K key, Callable<? extends V> loader) throws ExecutionException 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 Returns a map of the values associated with
| |
| getIfPresent | back to summary |
|---|---|
| public V getIfPresent(Object key) Returns the value associated with
| |
| invalidate | back to summary |
|---|---|
| public void invalidate(Object key) Discards any cached value for key | |
| invalidateAll | back to summary |
|---|---|
| public void invalidateAll(Iterable<? extends Object> keys) Discards any cached values for keys
| |
| invalidateAll | back to summary |
|---|---|
| public void invalidateAll() Discards all entries in the cache. | |
| put | back to summary |
|---|---|
| public void put(K key, V value) Associates Prefer
| |
| putAll | back to summary |
|---|---|
| public void putAll(Map<? extends K, ? extends V> m) 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() Returns the approximate number of entries in this cache. | |
| stats | back to summary |
|---|---|
| public CacheStats stats() 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 | |