public final class DelegatingNullSafeCheckedCache<K,V,E extends Exception> extends Object implements CheckedCache<K,V,E>
Constructor and Description |
---|
DelegatingNullSafeCheckedCache(CheckedCache<K,V,E> delegate) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
evict(K key)
Evict an entry from the cache.
|
com.google.common.collect.ImmutableMap<K,V> |
get(Iterable<? extends K> keys) |
V |
get(K key)
Get cache entry.
|
CacheManager |
getManager() |
void |
put(K key,
V value)
Puts a new entry into the Cache, replacing any existing one.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
get
public DelegatingNullSafeCheckedCache(CheckedCache<K,V,E> delegate)
public V get(K key) throws BadCacheFunctionRuntimeException, E extends Exception
CheckedCache
Cache.get(Object)
for more documentation.get
in interface CheckedCache<K,V,E extends Exception>
E
- if the cache's function throw that exception for this keyBadCacheFunctionRuntimeException
E extends Exception
public com.google.common.collect.ImmutableMap<K,V> get(Iterable<? extends K> keys) throws BadCacheFunctionRuntimeException, E extends Exception
get
in interface CheckedCache<K,V,E extends Exception>
BadCacheFunctionRuntimeException
E extends Exception
public void put(K key, V value)
BaseCache
Normally, you often never need to call this method, as in regular usage
scenarios a cache API client just invokes Cache.get(Object)
(or CheckedCache.get(Object)
,
which then internally (may) use the CacheFunction
(or CheckedCacheFunction
) - without you
ever having had to explicitly put something into the Cache.
This method is ONLY (!) intended for "optimizations". It is useful if the code
using a cache already has a key and value (e.g. following an external update
notification event kind of thing) and wants to "save time" on an expected
subsequent Cache.get(Object)
(or CheckedCache.get(Object)
invoking the CacheFunction
(or CheckedCacheFunction
)
unnecessarily, using this "hint" to "propose" an entry to the cache.
Any code using this must expect key/value pairs that have been put into a
cache to disappear at any time (e.g. when the cache is full and this
key/value hasn't been used, or after a programmatic or end-user operator
initiated eviction), and be able to obtain THE SAME value from the
CacheFunction
(or CheckedCacheFunction
), for the given key.
Failure to implement calls to this put method consistent with the implementation of the cache's get function WILL lead to weird cache inconsistencies!
Some Cache implementations may IGNORE this "hint" method.
public void evict(K key)
BaseCache
Use CacheManager.evictAll()
to evict all entries of the entire cache.
public CacheManager getManager()
getManager
in interface BaseCache<K,V>
public void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 2019 OpenDaylight. All rights reserved.