Package com.xxl.tool.cache.impl
Class NoCache<K,V>
java.lang.Object
com.xxl.tool.cache.impl.NoCache<K,V>
- Type Parameters:
K-V-
- All Implemented Interfaces:
Cache<K,,V> Serializable
No Cache
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasMap()返回 键-值 映射,仅包括有效数据intcapacity()缓存容量,0表示无限制voidclear()清空缓存对象booleancontainsKey(K key) 是否包含key获取缓存对象get(K key, CacheLoader<K, V> cacheLoader) 获取缓存对象getIfPresent(K key) 获取缓存对象longhitCount()booleanisEmpty()缓存是否为空booleanisFull()缓存是否已满,仅用于有空间限制的缓存对象longintprune()清理过期缓存对象void设置缓存对象void删除单个缓存对象intsize()缓存对象数量longtimeout()缓存有效期,0表示无限制,单位毫秒Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.xxl.tool.cache.iface.Cache
setListener, setLoader
-
Constructor Details
-
NoCache
public NoCache()
-
-
Method Details
-
put
Description copied from interface:Cache设置缓存对象 -
get
Description copied from interface:Cache获取缓存对象1、缓存对象不存在 或 已过期:尝试使用 cacheLoader 加载并返回对象,如果 cacheLoader 不存在返回
null2、每次调用此方法会刷新最后访问时间,即重新计算超时时间 -
getIfPresent
Description copied from interface:Cache获取缓存对象1、缓存对象不存在 或 已过期:直接返回
null2、每次调用此方法会刷新最后访问时间,即重新计算超时时间- Specified by:
getIfPresentin interfaceCache<K,V> - Parameters:
key- 键- Returns:
- 值对象
-
get
Description copied from interface:Cache获取缓存对象1、缓存对象不存在 或 已过期:使用 cacheLoader 加载并返回对象 2、每次调用此方法,可选是否 刷新最后访问时间,即重新计算超时时间
-
containsKey
Description copied from interface:Cache是否包含key- Specified by:
containsKeyin interfaceCache<K,V> - Parameters:
key- 键- Returns:
- 值对象
-
asMap
Description copied from interface:Cache返回 键-值 映射,仅包括有效数据 -
size
public int size()Description copied from interface:Cache缓存对象数量1、包含过期数据
-
isFull
public boolean isFull()Description copied from interface:Cache缓存是否已满,仅用于有空间限制的缓存对象1、包含过期数据
-
isEmpty
public boolean isEmpty()Description copied from interface:Cache缓存是否为空1、包含过期数据
-
remove
Description copied from interface:Cache删除单个缓存对象 -
prune
public int prune()Description copied from interface:Cache清理过期缓存对象 -
clear
public void clear()Description copied from interface:Cache清空缓存对象 -
hitCount
public long hitCount() -
missCount
public long missCount() -
capacity
public int capacity()Description copied from interface:Cache缓存容量,0表示无限制 -
timeout
public long timeout()Description copied from interface:Cache缓存有效期,0表示无限制,单位毫秒
-