public class RedisCache extends AbstractCache
Modifier and Type | Field and Description |
---|---|
protected RedisExecutor |
executor |
protected static org.apache.commons.logging.Log |
log |
protected String |
namespace |
protected static String |
UTF_8 |
name, ttl
Constructor and Description |
---|
RedisCache(CacheDescriptor desc) |
Modifier and Type | Method and Description |
---|---|
protected static byte[] |
bytes(String string) |
protected Serializable |
deserializeValue(byte[] workBytes) |
protected String |
formatKey(String key) |
Serializable |
get(String key)
Get method to retrieve value from cache Must not raise exception if the key is null, but return null
|
boolean |
hasEntry(String key)
Check if a given key is present inside the cache.
|
void |
invalidate(String key)
Invalidate the given key
|
void |
invalidateAll()
Invalidate all key-value stored in the cache
|
void |
put(String key,
Serializable value)
Put method to store a
Serializable value |
protected byte[] |
serializeValue(Serializable value) |
getName
protected static final String UTF_8
protected static final org.apache.commons.logging.Log log
protected final RedisExecutor executor
public RedisCache(CacheDescriptor desc)
protected Serializable deserializeValue(byte[] workBytes) throws IOException
IOException
public Serializable get(String key)
Cache
key
- the string keySerializable
value, return null if the key does not exist or if the key is nullprotected byte[] serializeValue(Serializable value) throws IOException
IOException
public void invalidate(String key)
Cache
public void invalidateAll()
Cache
public void put(String key, Serializable value)
Cache
Serializable
valuekey
- the string key, if null, the value will not be storedvalue
- the value to store, if null, the value will not be storedpublic boolean hasEntry(String key)
Cache
hasEntry
in interface Cache
hasEntry
in class AbstractCache
key
- the string keyCopyright © 2015 Nuxeo SA. All rights reserved.