CacheBuilder.
Implementations of this interface are expected to be thread-safe, and can be safely accessed by multiple concurrent threads.
When evaluated as a Function, a cache yields the same result as invoking getUnchecked.
| Modifier and Type | Method and Description |
|---|---|
| public V | apply(K
the function argument key)Redeclares com.
Deprecated
Provided to satisfy the
Applies this function to the given argument.
Function interface; use get or getUnchecked instead.
|
| public ConcurrentMap | asMap()
Redeclares com. |
| public V | get(K key)
Returns the value associated with |
| public ImmutableMap | |
| public V | getUnchecked(K key)
Returns the value associated with |
| public void |
| apply | back to summary |
|---|---|
| public V apply(K key) Redeclares com. Doc from java. Deprecated Provided to satisfy the Applies this function to the given argument.
| |
| asMap | back to summary |
|---|---|
| public ConcurrentMap Redeclares 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. Note that although the view is modifiable, no method on the returned map will ever cause entries to be automatically loaded.
| |
| get | back to summary |
|---|---|
| public V get(K key) throws ExecutionException Returns the value associated with If another call to Caches loaded by a If the cache loader associated with this cache is known not to throw checked exceptions,
then prefer
| |
| getAll | back to summary |
|---|---|
| public ImmutableMap 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) 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) Loads a new value for Caches loaded by a Returns without doing anything if another thread is currently loading the value for
| |