Cache.ValueWrapper
Constructor and Description |
---|
RedisCache(String name,
byte[] prefix,
RedisTemplate<? extends Object,? extends Object> template,
long expiration)
Constructs a new
RedisCache instance. |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
evict(Object key) |
void |
evict(RedisCacheElement element) |
Cache.ValueWrapper |
get(Object key) |
<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.
|
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() . |
public RedisCache(String name, byte[] prefix, RedisTemplate<? extends Object,? extends Object> template, long expiration)
RedisCache
instance.name
- cache nameprefix
- template
- expiration
- public <T> T get(Object key, Class<T> type)
public Cache.ValueWrapper get(Object key)
public 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.public 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(RedisCacheElement element)
element
- RedisCacheElement.getKeyBytes()
public Object getNativeCache()
getNativeCache
in interface Cache