类 AbstractRedisCacheServiceImpl
java.lang.Object
top.zenyoung.service.impl.AbstractRedisCacheServiceImpl
- 所有已实现的接口:
CacheService
public abstract class AbstractRedisCacheServiceImpl extends Object implements CacheService
Redis缓存-服务接口实现
- 版本:
- 1.0
- 作者:
- yangyong
-
字段概要
字段 修饰符和类型 字段 说明 private static DurationCACHE_EXPIREprivate static Map<String,Object>LOCKSprivate org.springframework.data.redis.core.StringRedisTemplateredisTemplate -
构造器概要
构造器 限定符 构造器 说明 protectedAbstractRedisCacheServiceImpl(org.springframework.data.redis.core.StringRedisTemplate redisTemplate)构造函数 -
方法概要
修饰符和类型 方法 说明 <T extends Serializable>
voidaddCache(String key, T data)添加缓存数据<T extends Serializable>
voidaddCache(String key, T data, Duration liveTime)添加缓存数据protected abstract <T extends Serializable>
Tdeserializable(String json, Class<T> dataClass)数据反序列化<T extends Serializable>
TgetCache(String key, Class<T> dataClass)获取缓存数据protected DurationgetCacheDefaultExpire()获取缓存默认有效期protected abstract StringgetCachePrefix()获取缓存前缀protected StringgetRedisKey(String key)获取Redis缓存键protected abstract <T extends Serializable>
Stringserializable(T data)数据序列化
-
字段详细资料
-
LOCKS
-
CACHE_EXPIRE
-
redisTemplate
private final org.springframework.data.redis.core.StringRedisTemplate redisTemplate
-
-
构造器详细资料
-
AbstractRedisCacheServiceImpl
protected AbstractRedisCacheServiceImpl(@Nonnull org.springframework.data.redis.core.StringRedisTemplate redisTemplate)构造函数- 参数:
redisTemplate- Redis模板
-
-
方法详细资料
-
getCachePrefix
获取缓存前缀- 返回:
- 缓存前缀
-
getCacheDefaultExpire
获取缓存默认有效期- 返回:
- 默认有效期
-
addCache
从接口复制的说明:CacheService添加缓存数据- 指定者:
addCache在接口中CacheService- 类型参数:
T- 缓存数据类型- 参数:
key- 缓存键data- 缓存数据
-
getRedisKey
获取Redis缓存键- 参数:
key- 缓存键- 返回:
- Redis缓存键
-
serializable
数据序列化- 类型参数:
T- 数据类型- 参数:
data- 数据- 返回:
- 序列化结果
-
deserializable
protected abstract <T extends Serializable> T deserializable(@Nonnull String json, @Nonnull Class<T> dataClass)数据反序列化- 类型参数:
T- 数据类型- 参数:
json- 序列化数据dataClass- 数据类型Class- 返回:
- 数据
-
addCache
public <T extends Serializable> void addCache(@Nonnull String key, @Nonnull T data, @Nonnull Duration liveTime)从接口复制的说明:CacheService添加缓存数据- 指定者:
addCache在接口中CacheService- 类型参数:
T- 缓存数据类型- 参数:
key- 缓存键data- 缓存数据liveTime- 缓存生存期
-
getCache
从接口复制的说明:CacheService获取缓存数据- 指定者:
getCache在接口中CacheService- 类型参数:
T- 缓存数据类型- 参数:
key- 缓存键dataClass- 缓存数据类型Class- 返回:
- 缓存数据
-