|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object play.cache.Cache
public abstract class Cache
The Cache. Mainly an interface to memcached.
Field Summary | |
---|---|
static CacheImpl |
cacheImpl
The underlying cache implementation |
static CacheImpl |
forcedCacheImpl
Sometime we REALLY need to change the implementation :) |
Constructor Summary | |
---|---|
Cache()
|
Method Summary | ||
---|---|---|
static void |
add(java.lang.String key,
java.lang.Object value)
Add an element only if it doesn't exist and store it indefinitly. |
|
static void |
add(java.lang.String key,
java.lang.Object value,
java.lang.String expiration)
Add an element only if it doesn't exist. |
|
static void |
clear()
Clear all data from cache. |
|
static long |
decr(java.lang.String key)
Decrement the element value (must be a Number) by 1. |
|
static long |
decr(java.lang.String key,
int by)
Decrement the element value (must be a Number). |
|
static void |
delete(java.lang.String key)
Delete an element from the cache. |
|
static java.util.Map<java.lang.String,java.lang.Object> |
get(java.lang.String... key)
Bulk retrieve. |
|
static java.lang.Object |
get(java.lang.String key)
Retrieve an object. |
|
static
|
get(java.lang.String key,
java.lang.Class<T> clazz)
Convenient clazz to get a value a class type; |
|
static long |
incr(java.lang.String key)
Increment the element value (must be a Number) by 1. |
|
static long |
incr(java.lang.String key,
int by)
Increment the element value (must be a Number). |
|
static void |
init()
Init the cache system. |
|
static void |
replace(java.lang.String key,
java.lang.Object value)
Replace an element only if it already exists and store it indefinitly. |
|
static void |
replace(java.lang.String key,
java.lang.Object value,
java.lang.String expiration)
Replace an element only if it already exists. |
|
static boolean |
safeAdd(java.lang.String key,
java.lang.Object value,
java.lang.String expiration)
Add an element only if it doesn't exist, and return only when the element is effectivly cached. |
|
static boolean |
safeDelete(java.lang.String key)
Delete an element from the cache and return only when the element is effectivly removed. |
|
static boolean |
safeReplace(java.lang.String key,
java.lang.Object value,
java.lang.String expiration)
Replace an element only if it already exists and return only when the element is effectivly cached. |
|
static boolean |
safeSet(java.lang.String key,
java.lang.Object value,
java.lang.String expiration)
Set an element and return only when the element is effectivly cached. |
|
static void |
set(java.lang.String key,
java.lang.Object value)
Set an element and store it indefinitly. |
|
static void |
set(java.lang.String key,
java.lang.Object value,
java.lang.String expiration)
Set an element. |
|
static void |
stop()
Stop the cache system. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static CacheImpl cacheImpl
public static CacheImpl forcedCacheImpl
Constructor Detail |
---|
public Cache()
Method Detail |
---|
public static void add(java.lang.String key, java.lang.Object value, java.lang.String expiration)
key
- Element keyvalue
- Element valueexpiration
- Ex: 10s, 3mn, 8hpublic static boolean safeAdd(java.lang.String key, java.lang.Object value, java.lang.String expiration)
key
- Element keyvalue
- Element valueexpiration
- Ex: 10s, 3mn, 8h
public static void add(java.lang.String key, java.lang.Object value)
key
- Element keyvalue
- Element valuepublic static void set(java.lang.String key, java.lang.Object value, java.lang.String expiration)
key
- Element keyvalue
- Element valueexpiration
- Ex: 10s, 3mn, 8hpublic static boolean safeSet(java.lang.String key, java.lang.Object value, java.lang.String expiration)
key
- Element keyvalue
- Element valueexpiration
- Ex: 10s, 3mn, 8h
public static void set(java.lang.String key, java.lang.Object value)
key
- Element keyvalue
- Element valuepublic static void replace(java.lang.String key, java.lang.Object value, java.lang.String expiration)
key
- Element keyvalue
- Element valueexpiration
- Ex: 10s, 3mn, 8hpublic static boolean safeReplace(java.lang.String key, java.lang.Object value, java.lang.String expiration)
key
- Element keyvalue
- Element valueexpiration
- Ex: 10s, 3mn, 8h
public static void replace(java.lang.String key, java.lang.Object value)
key
- Element keyvalue
- Element valuepublic static long incr(java.lang.String key, int by)
key
- Element keyby
- The incr value
public static long incr(java.lang.String key)
key
- Element key
public static long decr(java.lang.String key, int by)
key
- Element keyby
- The decr value
public static long decr(java.lang.String key)
key
- Element key
public static java.lang.Object get(java.lang.String key)
key
- The element key
public static java.util.Map<java.lang.String,java.lang.Object> get(java.lang.String... key)
key
- List of keys
public static void delete(java.lang.String key)
key
- The element key *public static boolean safeDelete(java.lang.String key)
key
- The element key
public static void clear()
public static <T> T get(java.lang.String key, java.lang.Class<T> clazz)
T
- The needed typekey
- The element keyclazz
- The type class
public static void init()
public static void stop()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |