public class RedisCache
extends org.springframework.cache.support.AbstractValueAdaptingCache
| 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) |
org.springframework.cache.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(). |
org.springframework.cache.Cache.ValueWrapper |
putIfAbsent(Object key,
Object value) |
org.springframework.cache.Cache.ValueWrapper |
putIfAbsent(RedisCacheElement element)
Add the element as long as no element exists at
RedisCacheElement.getKeyBytes(). |
public 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 org.springframework.cache.Cacheget in class org.springframework.cache.support.AbstractValueAdaptingCachekey - type - DATAREDIS-243public org.springframework.cache.Cache.ValueWrapper get(Object key)
get in interface org.springframework.cache.Cacheget in class org.springframework.cache.support.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 org.springframework.cache.support.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 org.springframework.cache.Cache.ValueWrapper putIfAbsent(Object key, Object value)
public org.springframework.cache.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()
Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.