public interface AsyncCacheApi
| Modifier and Type | Method and Description |
|---|---|
<T> CompletionStage<Optional<T>> |
get(String key)
Retrieves an object by key.
|
default <T> CompletionStage<Optional<T>> |
getOptional(String key)
Deprecated.
Deprecated as of 2.8.0. Renamed to
get(String). |
<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<akka.Done> |
remove(String key)
Removes a value from the cache.
|
CompletionStage<akka.Done> |
removeAll()
Removes all values from the cache.
|
CompletionStage<akka.Done> |
set(String key,
Object value)
Sets a value without expiration.
|
CompletionStage<akka.Done> |
set(String key,
Object value,
int expiration)
Sets a value with expiration.
|
default SyncCacheApi |
sync() |
default SyncCacheApi sync()
<T> CompletionStage<Optional<T>> get(String key)
T - the type of the stored objectkey - the key to look up@Deprecated default <T> CompletionStage<Optional<T>> getOptional(String key)
get(String).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)
The value has no expiration.
T - the type of the valuekey - Item key.block - block returning value to set if key does not existCompletionStage<akka.Done> set(String key, Object value, int expiration)
key - Item key.value - The value to set.expiration - expiration in secondsCompletionStage<akka.Done> set(String key, Object value)
key - Item key.value - The value to set.CompletionStage<akka.Done> remove(String key)
key - The key to remove the value for.CompletionStage<akka.Done> removeAll()
UnsupportedOperationException - if this cache implementation does not support removing
all values.