@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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
sync
@Inject public DefaultAsyncCacheApi(play.api.cache.AsyncCacheApi cacheApi)
public <T> java.util.concurrent.CompletionStage<T> get(java.lang.String key)
AsyncCacheApi
get
in interface AsyncCacheApi
T
- 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)
AsyncCacheApi
getOrElseUpdate
in interface AsyncCacheApi
T
- 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)
AsyncCacheApi
getOrElseUpdate
in interface AsyncCacheApi
T
- 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)
AsyncCacheApi
set
in interface AsyncCacheApi
key
- 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)
AsyncCacheApi
set
in interface AsyncCacheApi
key
- Item key.value
- The value to set.public java.util.concurrent.CompletionStage<akka.Done> remove(java.lang.String key)
AsyncCacheApi
remove
in interface AsyncCacheApi
key
- The key to remove the value for.public java.util.concurrent.CompletionStage<akka.Done> removeAll()
AsyncCacheApi
removeAll
in interface AsyncCacheApi