ConcurrentLinkedHashMap.Builder<Integer,Integer>() .maximumWeightedCapacity(2). weigher(Weighers.singleton()).build(); map.put(1,1); map.put(2,2); map.put(3,3); System.out.println(map.get(1));//null 已经失效了 Syste
我们在使用 ConcurrentLinkedHashMap 时,首先需要引入 concurrentlinkedhashmap-lru jar包,其下载地址:https://mvnrepository.com/artifact/com.googlecode.concurrentlinkedhashmap/concurrentlinkedhashmap-lru 首先我们来简单介绍下 ConcurrentLinkedHashMap 基本的用法 public class App { public static void main(String[]...
util.concurrent.concurrentlinkedhashmap.Weighers; import org.springframework.beans.factory.InitializingBean; import java.util.concurrent.*; /** * 内存级别的缓存。 * 为了防止占用内存过大,故采用LRU算法维护缓存。 * * @author by yexuerui * @Date 2021-05-26 16:14 */ public class MemoryCache...