类 RedisGenericCache
java.lang.Object
net.oschina.j2cache.redis.RedisGenericCache
- 所有已实现的接口:
Cache,Level2Cache
Redis 缓存操作封装,基于 region+_key 实现多个 Region 的缓存(
- 作者:
- Winter Lau(javayou@gmail.com)
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidclear()已使用scan命令替换keys命令操作voidRemove items from the cacheboolean判断缓存数据是否存在byte[]读取缓存数据字节数组List<byte[]>getBytes(Collection<String> keys) 同时读取多个 Keykeys()1、线上redis服务大概率会禁用或重命名keys命令; 2、keys命令效率太低容易致使redis宕机; 所以使用scan命令替换keys命令操作,增加可用性及提升执行性能void设置缓存数据字节数组void设置缓存数据字节数组(带有效期)void同时设置多个数据void批量设置带 TTL 的缓存数据boolean是否支持缓存 TTL 的设置
-
构造器详细资料
-
RedisGenericCache
缓存构造- 参数:
namespace- 命名空间,用于在多个实例中避免 _key 的重叠region- 缓存区域的名称client- 缓存客户端接口
-
-
方法详细资料
-
supportTTL
public boolean supportTTL()从接口复制的说明:Level2Cache是否支持缓存 TTL 的设置- 指定者:
supportTTL在接口中Level2Cache- 返回:
- true/false if cache support ttl setting
-
getBytes
从接口复制的说明:Level2Cache读取缓存数据字节数组- 指定者:
getBytes在接口中Level2Cache- 参数:
key- cache key- 返回:
- cache data
-
getBytes
从接口复制的说明:Level2Cache同时读取多个 Key- 指定者:
getBytes在接口中Level2Cache- 参数:
keys- multiple cache key- 返回:
- cache values
-
setBytes
从接口复制的说明:Level2Cache设置缓存数据字节数组- 指定者:
setBytes在接口中Level2Cache- 参数:
key- cache keybytes- cache data
-
setBytes
从接口复制的说明:Level2Cache同时设置多个数据- 指定者:
setBytes在接口中Level2Cache- 参数:
bytes- cache data
-
setBytes
从接口复制的说明:Level2Cache设置缓存数据字节数组(带有效期)- 指定者:
setBytes在接口中Level2Cache- 参数:
key- cache keybytes- cache datatimeToLiveInSeconds- cache ttl
-
setBytes
从接口复制的说明:Level2Cache批量设置带 TTL 的缓存数据- 指定者:
setBytes在接口中Level2Cache- 参数:
bytes- cache datatimeToLiveInSeconds- cache ttl
-
exists
从接口复制的说明:Level2Cache判断缓存数据是否存在- 指定者:
exists在接口中Cache- 指定者:
exists在接口中Level2Cache- 参数:
key- cache key- 返回:
- true if cache key exists in redis
-
keys
1、线上redis服务大概率会禁用或重命名keys命令; 2、keys命令效率太低容易致使redis宕机; 所以使用scan命令替换keys命令操作,增加可用性及提升执行性能- 指定者:
keys在接口中Cache- 指定者:
keys在接口中Level2Cache- 返回:
- 返回键的集合
-
evict
从接口复制的说明:Level2CacheRemove items from the cache- 指定者:
evict在接口中Cache- 指定者:
evict在接口中Level2Cache- 参数:
keys- Cache key
-
clear
public void clear()已使用scan命令替换keys命令操作- 指定者:
clear在接口中Cache- 指定者:
clear在接口中Level2Cache
-