|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectplay.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(String key,
Object value)
Add an element only if it doesn't exist and store it indefinitly. |
|
static void |
add(String key,
Object value,
String expiration)
Add an element only if it doesn't exist. |
|
static void |
clear()
Clear all data from cache. |
|
static long |
decr(String key)
Decrement the element value (must be a Number) by 1. |
|
static long |
decr(String key,
int by)
Decrement the element value (must be a Number). |
|
static void |
delete(String key)
Delete an element from the cache. |
|
static Map<String,Object> |
get(String... key)
Bulk retrieve. |
|
static Object |
get(String key)
Retrieve an object. |
|
static
|
get(String key,
Class<T> clazz)
Convenient clazz to get a value a class type; |
|
static long |
incr(String key)
Increment the element value (must be a Number) by 1. |
|
static long |
incr(String key,
int by)
Increment the element value (must be a Number). |
|
static void |
init()
Init the cache system. |
|
static void |
replace(String key,
Object value)
Replace an element only if it already exists and store it indefinitly. |
|
static void |
replace(String key,
Object value,
String expiration)
Replace an element only if it already exists. |
|
static boolean |
safeAdd(String key,
Object value,
String expiration)
Add an element only if it doesn't exist, and return only when the element is effectivly cached. |
|
static boolean |
safeDelete(String key)
Delete an element from the cache and return only when the element is effectivly removed. |
|
static boolean |
safeReplace(String key,
Object value,
String expiration)
Replace an element only if it already exists and return only when the element is effectivly cached. |
|
static boolean |
safeSet(String key,
Object value,
String expiration)
Set an element and return only when the element is effectivly cached. |
|
static void |
set(String key,
Object value)
Set an element and store it indefinitly. |
|
static void |
set(String key,
Object value,
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(String key,
Object value,
String expiration)
key - Element keyvalue - Element valueexpiration - Ex: 10s, 3mn, 8h
public static boolean safeAdd(String key,
Object value,
String expiration)
key - Element keyvalue - Element valueexpiration - Ex: 10s, 3mn, 8h
public static void add(String key,
Object value)
key - Element keyvalue - Element value
public static void set(String key,
Object value,
String expiration)
key - Element keyvalue - Element valueexpiration - Ex: 10s, 3mn, 8h
public static boolean safeSet(String key,
Object value,
String expiration)
key - Element keyvalue - Element valueexpiration - Ex: 10s, 3mn, 8h
public static void set(String key,
Object value)
key - Element keyvalue - Element value
public static void replace(String key,
Object value,
String expiration)
key - Element keyvalue - Element valueexpiration - Ex: 10s, 3mn, 8h
public static boolean safeReplace(String key,
Object value,
String expiration)
key - Element keyvalue - Element valueexpiration - Ex: 10s, 3mn, 8h
public static void replace(String key,
Object value)
key - Element keyvalue - Element value
public static long incr(String key,
int by)
key - Element keyby - The incr value
public static long incr(String key)
key - Element key
public static long decr(String key,
int by)
key - Element keyby - The decr value
public static long decr(String key)
key - Element key
public static Object get(String key)
key - The element key
public static Map<String,Object> get(String... key)
key - List of keys
public static void delete(String key)
key - The element key *public static boolean safeDelete(String key)
key - The element key
public static void clear()
public static <T> T get(String key,
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 | |||||||||