public class SyncCacheApiAdapter extends java.lang.Object implements SyncCacheApi, CacheApi
Constructor and Description |
---|
SyncCacheApiAdapter(play.api.cache.SyncCacheApi scalaApi) |
Modifier and Type | Method and Description |
---|---|
<T> T |
get(java.lang.String key)
Retrieves an object by key.
|
<T> T |
getOrElse(java.lang.String key,
java.util.concurrent.Callable<T> block)
Retrieve a value from the cache, or set it from a default Callable function.
|
<T> T |
getOrElse(java.lang.String key,
java.util.concurrent.Callable<T> block,
int expiration)
Retrieve a value from the cache, or set it from a default Callable function.
|
<T> T |
getOrElseUpdate(java.lang.String key,
java.util.concurrent.Callable<T> block)
Retrieve a value from the cache, or set it from a default Callable function.
|
<T> T |
getOrElseUpdate(java.lang.String key,
java.util.concurrent.Callable<T> block,
int expiration)
Retrieve a value from the cache, or set it from a default Callable function.
|
void |
remove(java.lang.String key)
Removes a value from the cache.
|
void |
set(java.lang.String key,
java.lang.Object value)
Sets a value without expiration.
|
void |
set(java.lang.String key,
java.lang.Object value,
int expiration)
Sets a value with expiration.
|
public SyncCacheApiAdapter(play.api.cache.SyncCacheApi scalaApi)
public <T> T get(java.lang.String key)
SyncCacheApi
get
in interface CacheApi
get
in interface SyncCacheApi
T
- the type of the stored objectkey
- the key to look uppublic <T> T getOrElseUpdate(java.lang.String key, java.util.concurrent.Callable<T> block, int expiration)
SyncCacheApi
getOrElseUpdate
in interface SyncCacheApi
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> T getOrElse(java.lang.String key, java.util.concurrent.Callable<T> block, int expiration)
CacheApi
public <T> T getOrElseUpdate(java.lang.String key, java.util.concurrent.Callable<T> block)
SyncCacheApi
The value has no expiration.
getOrElseUpdate
in interface SyncCacheApi
T
- the type of the valuekey
- Item key.block
- block returning value to set if key does not existpublic <T> T getOrElse(java.lang.String key, java.util.concurrent.Callable<T> block)
CacheApi
The value has no expiration.
public void set(java.lang.String key, java.lang.Object value, int expiration)
SyncCacheApi
set
in interface CacheApi
set
in interface SyncCacheApi
key
- Item key.value
- The value to set.expiration
- expiration in secondspublic void set(java.lang.String key, java.lang.Object value)
SyncCacheApi
set
in interface CacheApi
set
in interface SyncCacheApi
key
- Item key.value
- The value to set.public void remove(java.lang.String key)
SyncCacheApi
remove
in interface CacheApi
remove
in interface SyncCacheApi
key
- The key to remove the value for.