/** * Initialize a cache with initial capacity with weightedCapacity */ public static <K extends IMeasurableMemory, V extends IMeasurableMemory> ConcurrentLinkedHashCache<K, V> create(long weightedCapacity, EntryWeigher<K, V> entryWeiger) { ConcurrentLinkedHashMap<K, V> map = new ConcurrentLinkedHashMap.Builder<K, V>() .weigher(entryWeiger) .maximumWeightedCapacity(weightedCapacity) .concurrencyLevel(DEFAULT_CONCURENCY_LEVEL) .build(); return new ConcurrentLinkedHashCache<>(map); }
/** * Initialize a cache with initial capacity with weightedCapacity */ public static <K extends IMeasurableMemory, V extends IMeasurableMemory> ConcurrentLinkedHashCache<K, V> create(long weightedCapacity, EntryWeigher<K, V> entryWeiger) { ConcurrentLinkedHashMap<K, V> map = new ConcurrentLinkedHashMap.Builder<K, V>() .weigher(entryWeiger) .maximumWeightedCapacity(weightedCapacity) .concurrencyLevel(DEFAULT_CONCURENCY_LEVEL) .build(); return new ConcurrentLinkedHashCache<K, V>(map); }
/** * Initialize a cache with initial capacity with weightedCapacity */ public static <K extends IMeasurableMemory, V extends IMeasurableMemory> ConcurrentLinkedHashCache<K, V> create(long weightedCapacity, EntryWeigher<K, V> entryWeiger) { ConcurrentLinkedHashMap<K, V> map = new ConcurrentLinkedHashMap.Builder<K, V>() .weigher(entryWeiger) .maximumWeightedCapacity(weightedCapacity) .concurrencyLevel(DEFAULT_CONCURENCY_LEVEL) .build(); return new ConcurrentLinkedHashCache<>(map); }
/** * Initialize a cache with initial capacity with weightedCapacity */ public static <K extends IMeasurableMemory, V extends IMeasurableMemory> ConcurrentLinkedHashCache<K, V> create(long weightedCapacity, EntryWeigher<K, V> entryWeiger) { ConcurrentLinkedHashMap<K, V> map = new ConcurrentLinkedHashMap.Builder<K, V>() .weigher(entryWeiger) .maximumWeightedCapacity(weightedCapacity) .concurrencyLevel(DEFAULT_CONCURENCY_LEVEL) .build(); return new ConcurrentLinkedHashCache<>(map); }