@Beta public class LruCache<K,V> extends LinkedHashMap<K,V>
LinkedHashMap
The eviction policy can be access order or insertion order.
Beta class. Classes under com.force.i18n.commons package will be moved into a dedicated project.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
LruCache(int capacity)
Uses access order for the eviction policy.
|
LruCache(int capacity,
boolean accessOrder) |
LruCache(int capacity,
int initialCapacity) |
LruCache(int capacity,
int initialCapacity,
boolean accessOrder) |
| Modifier and Type | Method and Description |
|---|---|
int |
getCapacity() |
protected boolean |
removeEldestEntry(Map.Entry<K,V> eldest) |
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeequals, hashCode, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizepublic LruCache(int capacity)
capacity - max capacity of the cache.public LruCache(int capacity,
int initialCapacity)
public LruCache(int capacity,
boolean accessOrder)
public LruCache(int capacity,
int initialCapacity,
boolean accessOrder)
protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
removeEldestEntry in class LinkedHashMap<K,V>public int getCapacity()
Copyright (c) 2016-2017, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE.txt file in the repository.