类 RedisCache
java.lang.Object
cn.myafx.cache.base.BaseCache
cn.myafx.cache.base.RedisCache
- 所有已实现的接口:
IBaseCache,IRedisCache,AutoCloseable
- 直接已知子类:
GeoCache,HashCache,LinkListCache,SetCache,SortSetCache,StringCache
redis 缓存
-
字段概要
字段修饰符和类型字段说明static IJsonMapperprotected CacheKeyConfig缓存key配置protected IJsonMapperprotected StringNodeNameprotected String缓存前缀protected org.springframework.data.redis.connection.RedisConnectionredis -
构造器概要
构造器构造器说明RedisCache(String node, String item, org.springframework.data.redis.connection.RedisConnection redisConnection, ICacheKey cacheKey, String prefix) RedisCache -
方法概要
修饰符和类型方法说明voidclose()closeboolean缓存key是否存在protected <T> Tdeserialize(byte[] buffer, Class<T> clazz) Deserializeboolean设置缓存有效时间boolean根据系统配置设置缓存有效时间protected byte[]intgetCacheDb(String cachekey) 获取完整key所在dbgetCacheKey(Object[] args) 获取完整缓存keyprotected ObjectgetDefault(Class<?> clazz) getDefault缓存key配置protected StringgetString(byte[] buffer) ping()pingboolean移除缓存protected byte[]SerializevoidsetJsonMapper(IJsonMapper mapper) set ObjectMapper
-
字段详细资料
-
DefaultJsonMapper
-
mapper
-
redis
protected org.springframework.data.redis.connection.RedisConnection redisredis -
keyConfig
缓存key配置 -
prefix
缓存前缀 -
nodeName
NodeName
-
-
构造器详细资料
-
RedisCache
public RedisCache(String node, String item, org.springframework.data.redis.connection.RedisConnection redisConnection, ICacheKey cacheKey, String prefix) throws Exception RedisCache- 参数:
node- 缓存key配置db节点item- 缓存key配置项redisConnection- RedisConnectioncacheKey- ICacheKeyprefix- 缓存前缀- 抛出:
Exception
-
-
方法详细资料
-
setJsonMapper
set ObjectMapper- 指定者:
setJsonMapper在接口中IRedisCache
-
getDefault
getDefault- 参数:
clazz- clazz- 返回:
- clazz default value
- 抛出:
Exception
-
getBytes
- 抛出:
Exception
-
getString
- 抛出:
Exception
-
serialize
Serialize- 参数:
value- Object- 返回:
- byte[]
- 抛出:
Exception
-
deserialize
Deserialize- 类型参数:
T- T- 参数:
buffer- bufferclazz- clazz- 返回:
- T
- 抛出:
Exception
-
getKeyConfig
缓存key配置- 指定者:
getKeyConfig在接口中IRedisCache- 返回:
-
getCacheKey
获取完整缓存key- 指定者:
getCacheKey在接口中IRedisCache- 参数:
args- 缓存key参数- 返回:
- key
- 抛出:
Exception
-
getCacheDb
获取完整key所在db- 指定者:
getCacheDb在接口中IRedisCache- 参数:
cachekey- 完整缓存key- 返回:
-
remove
移除缓存- 指定者:
remove在接口中IRedisCache- 参数:
args- 缓存key参数- 返回:
- 抛出:
Exception
-
contains
缓存key是否存在- 指定者:
contains在接口中IRedisCache- 参数:
args- 缓存key参数- 返回:
- 抛出:
Exception
-
expire
设置缓存有效时间- 指定者:
expire在接口中IRedisCache- 参数:
expireSeconds- 缓存有效时间, 秒args- 缓存key参数- 返回:
- 抛出:
Exception
-
expire
根据系统配置设置缓存有效时间- 指定者:
expire在接口中IRedisCache- 参数:
args- 缓存key参数- 返回:
- 抛出:
Exception
-
ping
ping- 指定者:
ping在接口中IRedisCache- 返回:
-
close
close- 指定者:
close在接口中AutoCloseable- 抛出:
Exception
-