Package play.cache
Class Cache
java.lang.Object
play.cache.Cache
The Cache. Mainly an interface to Memcached or EhCache.
Choose cache implementation by having your project depend on either one of these RePlay
packages: `memcached` or `ehcache`. Without one of these packages the fall-back "dummy" cache
is used, which does not do any caching.
Note: When specifying expiration == "0s" (zero seconds) the actual expiration-time may vary between different cache implementations
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Cache
public Cache()
-
-
Method Details
-
set
Set an element.- Parameters:
key- Element keyvalue- Element valueexpiration- Ex: 10s, 3mn, 8h
-
get
Retrieve an object.- Parameters:
key- The element key- Returns:
- The element value or null
-
delete
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.
-