public class RedisCache extends AbstractValueAdaptingCache
Cache.ValueRetrievalException, Cache.ValueWrapper| Constructor and Description |
|---|
RedisCache(String name,
byte[] prefix,
RedisOperations<? extends Object,? extends Object> redisOperations,
long expiration)
Constructs a new
RedisCache instance. |
RedisCache(String name,
byte[] prefix,
RedisOperations<? extends Object,? extends Object> redisOperations,
long expiration,
boolean allowNullValues)
Constructs a new
RedisCache instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
evict(Object key) |
void |
evict(RedisCacheElement element) |
protected Object |
fromStoreValue(Object storeValue) |
Cache.ValueWrapper |
get(Object key) |
<T> T |
get(Object key,
Callable<T> valueLoader) |
<T> T |
get(Object key,
Class<T> type)
Return the value to which this cache maps the specified key, generically specifying a type that return value will
be cast to.
|
RedisCacheElement |
get(RedisCacheKey cacheKey)
Return the value to which this cache maps the specified key.
|
String |
getName() |
Object |
getNativeCache()
This implementation simply returns the RedisTemplate used for configuring the cache, giving access to
the underlying Redis store.
|
protected Object |
lookup(Object key) |
void |
put(Object key,
Object value) |
void |
put(RedisCacheElement element)
Add the element by adding
SimpleValueWrapper.get() at RedisCacheElement.getKeyBytes(). |
Cache.ValueWrapper |
putIfAbsent(Object key,
Object value) |
Cache.ValueWrapper |
putIfAbsent(RedisCacheElement element)
Add the element as long as no element exists at
RedisCacheElement.getKeyBytes(). |
isAllowNullValues, toStoreValue, toValueWrapperpublic RedisCache(String name, byte[] prefix, RedisOperations<? extends Object,? extends Object> redisOperations, long expiration)
RedisCache instance.name - cache nameprefix - redisOperations - expiration - public RedisCache(String name, byte[] prefix, RedisOperations<? extends Object,? extends Object> redisOperations, long expiration, boolean allowNullValues)
RedisCache instance.name - cache nameprefix - must not be null or empty.redisOperations - expiration - allowNullValues - public <T> T get(Object key, Class<T> type)
get in interface Cacheget in class AbstractValueAdaptingCachekey - type - DATAREDIS-243public Cache.ValueWrapper get(Object key)
get in interface Cacheget in class AbstractValueAdaptingCachepublic RedisCacheElement get(RedisCacheKey cacheKey)
cacheKey - the key whose associated value is to be returned via its binary representation.RedisCacheElement stored at given key or null if no value found for key.protected Object fromStoreValue(Object storeValue)
fromStoreValue in class AbstractValueAdaptingCachepublic void put(RedisCacheElement element)
SimpleValueWrapper.get() at RedisCacheElement.getKeyBytes(). If the cache
previously contained a mapping for this RedisCacheElement.getKeyBytes(), the old value is replaced by
SimpleValueWrapper.get().element - must not be null.public Cache.ValueWrapper putIfAbsent(Object key, Object value)
public Cache.ValueWrapper putIfAbsent(RedisCacheElement element)
RedisCacheElement.getKeyBytes(). If a value is present for
RedisCacheElement.getKeyBytes() this one is returned.element - must not be null.public void evict(Object key)
public void evict(RedisCacheElement element)
element - RedisCacheElement.getKeyBytes()public void clear()
public String getName()
public Object getNativeCache()
protected Object lookup(Object key)
lookup in class AbstractValueAdaptingCacheCopyright © 2011-2016–2016 Pivotal Software, Inc.. All rights reserved.