public class SpringRedisCache extends Object implements Level2Cache
log
Constructor and Description |
---|
SpringRedisCache(String namespace,
String region,
org.springframework.data.redis.core.RedisTemplate<String,Serializable> redisTemplate) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the cache
|
void |
evict(String... keys)
Remove items from the cache
|
boolean |
exists(String key)
判断缓存数据是否存在
|
List<byte[]> |
getBytes(Collection<String> keys)
同时读取多个 Key
|
byte[] |
getBytes(String key)
读取缓存数据字节数组
|
Collection<String> |
keys()
Return all keys
|
void |
put(String key,
Object value)
Add an item to the cache, nontransactionally, with
failfast semantics
|
void |
put(String key,
Object value,
long timeToLiveInSeconds)
设置缓存数据的有效期
|
void |
setBytes(Map<String,byte[]> bytes)
同时设置多个数据
|
void |
setBytes(String key,
byte[] bytes)
设置缓存数据字节数组
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, get, put, put, setBytes, setBytes, supportTTL
public SpringRedisCache(String namespace, String region, org.springframework.data.redis.core.RedisTemplate<String,Serializable> redisTemplate)
public void clear()
Level2Cache
clear
in interface Cache
clear
in interface Level2Cache
public boolean exists(String key)
Level2Cache
exists
in interface Cache
exists
in interface Level2Cache
key
- cache keypublic void evict(String... keys)
Level2Cache
evict
in interface Cache
evict
in interface Level2Cache
keys
- Cache keypublic Collection<String> keys()
Level2Cache
keys
in interface Cache
keys
in interface Level2Cache
public byte[] getBytes(String key)
Level2Cache
getBytes
in interface Level2Cache
key
- cache keypublic List<byte[]> getBytes(Collection<String> keys)
Level2Cache
getBytes
in interface Level2Cache
keys
- multiple cache keypublic void put(String key, Object value)
Cache
put
in interface Cache
put
in interface Level2Cache
key
- cache keyvalue
- cache valuepublic void put(String key, Object value, long timeToLiveInSeconds)
put
in interface Level2Cache
key
- cache keyvalue
- cache valuetimeToLiveInSeconds
- cache ttlpublic void setBytes(String key, byte[] bytes)
Level2Cache
setBytes
in interface Level2Cache
key
- cache keybytes
- cache datapublic void setBytes(Map<String,byte[]> bytes)
Level2Cache
setBytes
in interface Level2Cache
bytes
- cache dataCopyright © 2018. All rights reserved.