类 RedisCache
java.lang.Object
com.walker.support.redis.cache.RedisCache
- 所有已实现的接口:
Cache,Expired,com.walker.infrastructure.core.ApplicationBeanDestroied,com.walker.infrastructure.core.ApplicationBeanInitialized,Serializable
- 直接已知子类:
RedisPageCache
public class RedisCache
extends Object
implements Cache, com.walker.infrastructure.core.ApplicationBeanInitialized, com.walker.infrastructure.core.ApplicationBeanDestroied
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidclear()给定对象类型,返回缓存的对象。longgetIterator(Class<?> clazz) getKeys()获取整个集合值,0 到 -1代表所有值longgetListSize(String key) 获取集合元素数量。long返回持久化的的缓存数据数量,如:redis持久的getRootData(String key) 已过时。booleanbooleanvoidvoidvoidvoidputListAppend(String key, Object data) queryListLimit(int maxSize) 返回给定限制的缓存数据集合voidvoidremoveList(String key) 删除一个集合,待测试验证。voidremoveList(String key, Object value) 删除集合中的一个元素。voidvoidsetCacheName(String name) voidsetCacheOperateListener(CacheOperateListener cacheOperateListener) voidsetExpiredTime(int seconds) voidsetRedisHelper(RedisHelper redisHelper) voidsetSupportExpiredCache(boolean supportExpiredCache) 设置是否支持缓存失效,因为redis失效是针对key,因此HashMap方式是作为整体失效的!voidsetWriteOnDiskAfterShutdown(boolean boo) voidshutdown()longsize()voidstartup()void
-
字段详细资料
-
logger
protected final transient org.slf4j.Logger logger
-
-
构造器详细资料
-
RedisCache
-
-
方法详细资料
-
isSupportExpiredCache
public boolean isSupportExpiredCache() -
setSupportExpiredCache
public void setSupportExpiredCache(boolean supportExpiredCache) 设置是否支持缓存失效,因为redis失效是针对key,因此HashMap方式是作为整体失效的!1) 默认不支持缓存失效,此时使用Map方式存储数据 2) 当设置运行失效时,必须采用字符串形式的数据结构 3) 该选项只对hashmap数据结构有效。- 参数:
supportExpiredCache-
-
getRedisHelper
-
setRedisHelper
-
shutdown
public void shutdown()- 指定者:
shutdown在接口中com.walker.infrastructure.core.ApplicationBeanDestroied
-
startup
public void startup()- 指定者:
startup在接口中com.walker.infrastructure.core.ApplicationBeanInitialized
-
put
-
put
-
putList
-
putListAppend
- 指定者:
putListAppend在接口中Cache
-
getList
获取整个集合值,0 到 -1代表所有值 -
removeList
删除集合中的一个元素。从左往右删除list中元素A (1:从左往右 -1:从右往左 0:删除全部)- 指定者:
removeList在接口中Cache- 参数:
key- 集合唯一keyvalue- 元素内容,对象字符串
-
removeList
删除一个集合,待测试验证。- 指定者:
removeList在接口中Cache- 参数:
key-
-
getListSize
获取集合元素数量。- 指定者:
getListSize在接口中Cache- 参数:
key-- 返回:
-
remove
-
remove
-
getPersistentSize
public long getPersistentSize()返回持久化的的缓存数据数量,如:redis持久的- 指定者:
getPersistentSize在接口中Cache- 返回:
-
get
-
get
给定对象类型,返回缓存的对象。该方法在redis实现中用到 -
replace
-
clear
public void clear() -
updateCacheDataTimeStamp
- 指定者:
updateCacheDataTimeStamp在接口中Cache
-
getCacheName
- 指定者:
getCacheName在接口中Cache
-
setCacheName
- 指定者:
setCacheName在接口中Cache
-
isWriteOnDiskAfterShutdown
public boolean isWriteOnDiskAfterShutdown()- 指定者:
isWriteOnDiskAfterShutdown在接口中Cache
-
setWriteOnDiskAfterShutdown
public void setWriteOnDiskAfterShutdown(boolean boo) - 指定者:
setWriteOnDiskAfterShutdown在接口中Cache
-
getExpiredTime
public long getExpiredTime()- 指定者:
getExpiredTime在接口中Cache- 指定者:
getExpiredTime在接口中Expired
-
setExpiredTime
public void setExpiredTime(int seconds) - 指定者:
setExpiredTime在接口中Cache- 指定者:
setExpiredTime在接口中Expired
-
getIterator
- 指定者:
getIterator在接口中Cache
-
getKeys
-
getIterator
- 指定者:
getIterator在接口中Cache
-
setCacheOperateListener
- 指定者:
setCacheOperateListener在接口中Cache
-
getRootData
已过时。返回redis根下面的某个值。注意:该方法只有特殊场景使用,
因为这相当于存储数据没有表名,后续很难统计数量。- 参数:
key-- 返回:
-
size
public long size() -
queryListLimit
返回给定限制的缓存数据集合- 指定者:
queryListLimit在接口中Cache- 参数:
maxSize- 限制的最大数量- 返回:
-