Package com.xxl.tool.cache.impl
Class FIFOCache<K,V>
java.lang.Object
com.xxl.tool.cache.impl.ReentrantCache<K,V>
com.xxl.tool.cache.impl.FIFOCache<K,V>
- All Implemented Interfaces:
Cache<K,,V> Serializable
FIFO(first in first out) 先进先出缓存
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
-
FIFOCache
public FIFOCache(int capacity, long timeout, boolean expireType)
-
-
Method Details
-
doPrune
protected int doPrune()1、清理全部过期对象 2、如清理后依然存满,则删除最早加入的缓存对象;- Specified by:
doPrunein classReentrantCache<K,V> - Returns:
- 清理数据量
-