@Singleton public class DefaultAsyncCacheApi extends java.lang.Object implements AsyncCacheApi
| Constructor and Description |
|---|
DefaultAsyncCacheApi(play.api.cache.AsyncCacheApi cacheApi) |
| Modifier and Type | Method and Description |
|---|---|
<T> java.util.concurrent.CompletionStage<T> |
get(java.lang.String key)
Retrieves an object by key.
|
<T> java.util.concurrent.CompletionStage<T> |
getOrElseUpdate(java.lang.String key,
java.util.concurrent.Callable<java.util.concurrent.CompletionStage<T>> block)
Retrieve a value from the cache, or set it from a default Callable function.
|
<T> java.util.concurrent.CompletionStage<T> |
getOrElseUpdate(java.lang.String key,
java.util.concurrent.Callable<java.util.concurrent.CompletionStage<T>> block,
int expiration)
Retrieve a value from the cache, or set it from a default Callable function.
|
java.util.concurrent.CompletionStage<akka.Done> |
remove(java.lang.String key)
Removes a value from the cache.
|
java.util.concurrent.CompletionStage<akka.Done> |
removeAll()
Removes all values from the cache.
|
java.util.concurrent.CompletionStage<akka.Done> |
set(java.lang.String key,
java.lang.Object value)
Sets a value without expiration.
|
java.util.concurrent.CompletionStage<akka.Done> |
set(java.lang.String key,
java.lang.Object value,
int expiration)
Sets a value with expiration.
|
SyncCacheApi |
sync() |
@Inject public DefaultAsyncCacheApi(play.api.cache.AsyncCacheApi cacheApi)
public SyncCacheApi sync()
sync in interface AsyncCacheApipublic <T> java.util.concurrent.CompletionStage<T> get(java.lang.String key)
AsyncCacheApiget in interface AsyncCacheApiT - the type of the stored objectkey - the key to look uppublic <T> java.util.concurrent.CompletionStage<T> getOrElseUpdate(java.lang.String key,
java.util.concurrent.Callable<java.util.concurrent.CompletionStage<T>> block,
int expiration)
AsyncCacheApigetOrElseUpdate in interface AsyncCacheApiT - the type of the valuekey - Item key.block - block returning value to set if key does not existexpiration - expiration period in seconds.public <T> java.util.concurrent.CompletionStage<T> getOrElseUpdate(java.lang.String key,
java.util.concurrent.Callable<java.util.concurrent.CompletionStage<T>> block)
AsyncCacheApiThe value has no expiration.
getOrElseUpdate in interface AsyncCacheApiT - the type of the valuekey - Item key.block - block returning value to set if key does not existpublic java.util.concurrent.CompletionStage<akka.Done> set(java.lang.String key,
java.lang.Object value,
int expiration)
AsyncCacheApiset in interface AsyncCacheApikey - Item key.value - The value to set.expiration - expiration in secondspublic java.util.concurrent.CompletionStage<akka.Done> set(java.lang.String key,
java.lang.Object value)
AsyncCacheApiset in interface AsyncCacheApikey - Item key.value - The value to set.public java.util.concurrent.CompletionStage<akka.Done> remove(java.lang.String key)
AsyncCacheApiremove in interface AsyncCacheApikey - The key to remove the value for.public java.util.concurrent.CompletionStage<akka.Done> removeAll()
AsyncCacheApiremoveAll in interface AsyncCacheApi