K - Key type.V - Value type.public interface CacheFrontend<K,V> extends Closeable
| Modifier and Type | Interface and Description |
|---|---|
static class |
CacheFrontend.ValueRetrievalException
Wrapper exception to be thrown from
get(Object, Callable) in case of the value loader callback
failing with an exception. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this cache frontend and releases any system resources associated with it.
|
V |
get(K key)
Return the value to which this cache maps the specified key.
|
V |
get(K key,
Callable<V> valueLoader)
Return the value to which this cache maps the specified key, obtaining that value from
valueLoader if necessary. |
V get(K key)
Note: This method does not allow for differentiating between a cached null value and no cache entry found at all.
key - the key whose associated value is to be returned.null itself), or also null if
the cache contains no mapping for this key.CacheAccessor.get(Object),
RedisCache.get(Object)V get(K key, Callable<V> valueLoader)
valueLoader if necessary.
This method provides a simple substitute for the conventional "if cached, return; otherwise create, cache and return"
pattern.
If the valueLoader throws an exception, it is wrapped in a CacheFrontend.ValueRetrievalExceptionkey - the key whose associated value is to be returnedvalueLoader - the value loader that is used to obtain the value if the client-side cache and Redis cache are not
associated with a value.CacheFrontend.ValueRetrievalException - if the valueLoader throws an exception or returns a null value.void close()
close in interface AutoCloseableclose in interface CloseableCopyright © 2021 lettuce.io. All rights reserved.