Package play.cache
Class Cache
- java.lang.Object
-
- play.cache.Cache
-
public abstract class Cache extends java.lang.ObjectThe Cache. Mainly an interface to memcached or EhCache. Note: When specifying expiration == "0s" (zero seconds) the actual expiration-time may vary between different cache implementations
-
-
Constructor Summary
Constructors Constructor Description Cache()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclear()Clear all data from cache.static voiddelete(java.lang.String key)Delete an element from the cache.static <T> Tget(java.lang.String key)Retrieve an object.static voidinit()Initialize the cache system.static voidset(java.lang.String key, java.lang.Object value, java.lang.String expiration)Set an element.static voidstop()Stop the cache system.
-
-
-
Field Detail
-
cacheImpl
public static CacheImpl cacheImpl
The underlying cache implementation
-
-
Method Detail
-
set
public static void set(java.lang.String key, java.lang.Object value, java.lang.String expiration)Set an element.- Parameters:
key- Element keyvalue- Element valueexpiration- Ex: 10s, 3mn, 8h
-
get
@Nullable public static <T> T get(@Nonnull java.lang.String key)Retrieve an object.- Parameters:
key- The element key- Returns:
- The element value or null
-
delete
public static void delete(java.lang.String key)
Delete an element from the cache.- Parameters:
key- The element key
-
clear
public static void clear()
Clear all data from cache.
-
init
public static void init()
Initialize the cache system.
-
stop
public static void stop()
Stop the cache system.
-
-