接口 ICache
- 所有已知实现类:
AbsCache,CaffeineCache,CaffeineRedisCache,GuavaCache,GuavaRedisCache,J2Cache,RedisCache
public interface ICache
- 作者:
- tanyaowu 2017年8月10日 上午11:38:26
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明static final int在本地最大的过期时间,这样可以防止内存爆掉,单位:秒static final ICache.NullClass用于临时存放于缓存中的对象,防止缓存null攻击 -
方法概要
修饰符和类型方法说明voidclear()清空所有缓存根据key获取value<T> T根据key获取valuekeys()获取所有的keyvoidput(String key, Serializable value) 将key value保存到缓存中voidputTemporary(String key, Serializable value) 临时添加一个值,用于防止缓存穿透攻击void删除一个keylong对象还会存活多久。
-
字段详细资料
-
NULL_OBJ
用于临时存放于缓存中的对象,防止缓存null攻击 -
MAX_EXPIRE_IN_LOCAL
static final int MAX_EXPIRE_IN_LOCAL在本地最大的过期时间,这样可以防止内存爆掉,单位:秒- 另请参阅:
-
-
方法详细资料
-
getCacheName
String getCacheName()- 返回:
-
clear
void clear()清空所有缓存 -
get
根据key获取value- 参数:
key-- 返回:
-
get
根据key获取value- 参数:
key-clazz-- 返回:
-
keys
获取所有的key- 返回:
-
put
将key value保存到缓存中- 参数:
key-value-
-
remove
删除一个key- 参数:
key-
-
putTemporary
临时添加一个值,用于防止缓存穿透攻击- 参数:
key-value-
-
ttl
对象还会存活多久。- 返回:
- currTime in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
-
getTimeToLiveSeconds
Long getTimeToLiveSeconds()- 返回:
-
getTimeToIdleSeconds
Long getTimeToIdleSeconds()- 返回:
-