Uses of Interface
com.xxl.tool.cache.iface.Cache

Packages that use Cache
  • Uses of Cache in com.xxl.tool.cache

    Fields in com.xxl.tool.cache declared as Cache
    Modifier and Type
    Field
    Description
    protected Cache<K,V>
    CacheTool.cache
    缓存实现实例
    Methods in com.xxl.tool.cache that return Cache
    Modifier and Type
    Method
    Description
    <K, V> Cache<K,V>
    CacheTool.build()
    build cache
  • Uses of Cache in com.xxl.tool.cache.iface

    Methods in com.xxl.tool.cache.iface that return Cache
    Modifier and Type
    Method
    Description
    default Cache<K,V>
    Cache.setListener(CacheListener<K,V> listener)
    设置监听
    default Cache<K,V>
    Cache.setLoader(CacheLoader<K,V> listener)
    设置监听
  • Uses of Cache in com.xxl.tool.cache.impl

    Classes in com.xxl.tool.cache.impl that implement Cache
    Modifier and Type
    Class
    Description
    class 
    FIFO(first in first out) 先进先出缓存 1、元素持续添加直到存满,触发 清理全部过期对象; 2、清理后依然存满,则删除最早加入的缓存对象; 3、优劣势: - 优势:实现简单; - 劣势,热点数据无法保障常驻内存;
    class 
    LFU(least frequently used) 最少使用率缓存 1、元素持续添加直到存满,触发 清理全部过期对象; 2、清理后缓存仍存满时,清除最少访问(访问计数最小)的对象;并将其他对象的访问数减去这个最小访问数,以便新对象进入后可以公平计数。
    class 
    LRU (least recently used)最近最久未使用缓存 1、元素持续添加直到存满,触发 清理全部过期对象; 2、清理后缓存仍存满时,最久未被使用的对象将被移除; (此缓存基于LinkedHashMap,因此当被缓存的对象每被访问一次,这个对象的key就到链表头部) 3、优劣势: - 优势:简单、速度快;经常使用的对象,不会被被移除缓存; - 劣势:不能很快的访问缓存中不常用的对象;
    class 
    NoCache<K,V>
    No Cache
    class 
    Reentrant Cache
    class 
    无限容量缓存 1、无容量限制,不会因为容量触发缓存清理 2、线程安全,父类存在读写锁控制; 3、优劣势: - 优点:无容量限制,不会因为容量触发缓存清理; - 问题:内存占用不可用,容易造成内存溢出;需要结合 定义缓存清理策略 一起使用;