public interface AsyncCacheApi
| Modifier and Type | Method and Description |
|---|---|
<T> CompletionStage<T> |
get(String key)
Retrieves an object by key.
|
<T> CompletionStage<T> |
getOrElseUpdate(String key,
Callable<CompletionStage<T>> block)
Retrieve a value from the cache, or set it from a default Callable function.
|
<T> CompletionStage<T> |
getOrElseUpdate(String key,
Callable<CompletionStage<T>> block,
int expiration)
Retrieve a value from the cache, or set it from a default Callable function.
|
CompletionStage<Done> |
remove(String key)
Removes a value from the cache.
|
CompletionStage<Done> |
removeAll()
Removes all values from the cache.
|
CompletionStage<Done> |
set(String key,
Object value)
Sets a value without expiration.
|
CompletionStage<Done> |
set(String key,
Object value,
int expiration)
Sets a value with expiration.
|
default SyncCacheApi |
sync() |
default SyncCacheApi sync()
<T> CompletionStage<T> get(String key)
T - the type of the stored objectkey - the key to look up<T> CompletionStage<T> getOrElseUpdate(String key, Callable<CompletionStage<T>> block, int expiration)
T - the type of the valuekey - Item key.block - block returning value to set if key does not existexpiration - expiration period in seconds.<T> CompletionStage<T> getOrElseUpdate(String key, Callable<CompletionStage<T>> block)
T - the type of the valuekey - Item key.block - block returning value to set if key does not existCompletionStage<Done> set(String key, Object value, int expiration)
key - Item key.value - The value to set.expiration - expiration in secondsCompletionStage<Done> set(String key, Object value)
key - Item key.value - The value to set.CompletionStage<Done> remove(String key)
key - The key to remove the value for.CompletionStage<Done> removeAll()
UnsupportedOperationException - if this cache implementation does not support removing all values.