Package play.cache
Class SyncCacheApiAdapter
java.lang.Object
play.cache.SyncCacheApiAdapter
- All Implemented Interfaces:
SyncCacheApi
Adapts a Scala SyncCacheApi to a Java SyncCacheApi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Optional<T>Retrieves an object by key.<T> TgetOrElseUpdate(String key, Callable<T> block) Retrieve a value from the cache, or set it from a default Callable function.<T> TgetOrElseUpdate(String key, Callable<T> block, int expiration) Retrieve a value from the cache, or set it from a default Callable function.voidRemoves a value from the cache.voidSets a value without expiration.voidSets a value with expiration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface play.cache.SyncCacheApi
getOptional
-
Constructor Details
-
SyncCacheApiAdapter
public SyncCacheApiAdapter(play.api.cache.SyncCacheApi scalaApi)
-
-
Method Details
-
get
Description copied from interface:SyncCacheApiRetrieves an object by key.- Specified by:
getin interfaceSyncCacheApi- Type Parameters:
T- the type of the stored object- Parameters:
key- the key to look up- Returns:
- the object wrapped in an Optional
-
getOrElseUpdate
Description copied from interface:SyncCacheApiRetrieve a value from the cache, or set it from a default Callable function.- Specified by:
getOrElseUpdatein interfaceSyncCacheApi- Type Parameters:
T- the type of the value- Parameters:
key- Item key.block- block returning value to set if key does not existexpiration- expiration period in seconds.- Returns:
- the value
-
getOrElseUpdate
Description copied from interface:SyncCacheApiRetrieve a value from the cache, or set it from a default Callable function.The value has no expiration.
- Specified by:
getOrElseUpdatein interfaceSyncCacheApi- Type Parameters:
T- the type of the value- Parameters:
key- Item key.block- block returning value to set if key does not exist- Returns:
- the value
-
set
Description copied from interface:SyncCacheApiSets a value with expiration.- Specified by:
setin interfaceSyncCacheApi- Parameters:
key- Item key.value- The value to set.expiration- expiration in seconds
-
set
Description copied from interface:SyncCacheApiSets a value without expiration.- Specified by:
setin interfaceSyncCacheApi- Parameters:
key- Item key.value- The value to set.
-
remove
Description copied from interface:SyncCacheApiRemoves a value from the cache.- Specified by:
removein interfaceSyncCacheApi- Parameters:
key- The key to remove the value for.
-