Package com.xxl.tool.cache.impl
Class UnlimitedCache<K,V>
java.lang.Object
com.xxl.tool.cache.impl.ReentrantCache<K,V>
com.xxl.tool.cache.impl.UnlimitedCache<K,V>
- Type Parameters:
K-V-
- All Implemented Interfaces:
Cache<K,,V> Serializable
无限容量缓存
1、无容量限制,不会因为容量触发缓存清理
2、线程安全,父类存在读写锁控制;
3、优劣势:
- 优点:无容量限制,不会因为容量触发缓存清理;
- 问题:内存占用不可用,容易造成内存溢出;需要结合 定义缓存清理策略 一起使用;
- See Also:
-
Field Summary
Fields inherited from class com.xxl.tool.cache.impl.ReentrantCache
cacheMap, capacity, expireType, hitCount, listener, loader, missCount, timeout, writeLockCount, writeLockMap -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.xxl.tool.cache.impl.ReentrantCache
asMap, capacity, clear, containsKey, get, get, getIfPresent, hitCount, isEmpty, isFull, missCount, onRemove, prune, put, remove, removeWithoutLock, setListener, setLoader, size, timeout, toString
-
Constructor Details
-
UnlimitedCache
public UnlimitedCache(long timeout, boolean expireType)
-
-
Method Details
-
doPrune
protected int doPrune()Description copied from class:ReentrantCache清理实现
子类实现此方法时无需加锁- Specified by:
doPrunein classReentrantCache<K,V> - Returns:
- 清理数据量
-