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

public class FIFOCache<K,V> extends ReentrantCache<K,V>
FIFO(first in first out) 先进先出缓存 1、元素持续添加直到存满,触发 清理全部过期对象; 2、清理后依然存满,则删除最早加入的缓存对象; 3、优劣势: - 优势:实现简单; - 劣势,热点数据无法保障常驻内存;
See Also:
  • Constructor Details

    • FIFOCache

      public FIFOCache(int capacity, long timeout, boolean expireType)
  • Method Details

    • doPrune

      protected int doPrune()
      1、清理全部过期对象 2、如清理后依然存满,则删除最早加入的缓存对象;
      Specified by:
      doPrune in class ReentrantCache<K,V>
      Returns:
      清理数据量