类 LRUCache<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<K,V>
-
- org.apache.dubbo.common.utils.LRUCache<K,V>
-
- 所有已实现的接口:
Serializable,Cloneable,Map<K,V>
public class LRUCache<K,V> extends LinkedHashMap<K,V>
LRU-2 When the data accessed for the first time, add it to history list. If the size of history list reaches max capacity, eliminate the earliest data (first in first out). When the data already exists in the history list, and be accessed for the second time, then it will be put into cache.- 另请参阅:
- 序列化表格
-
-
嵌套类概要
-
从类继承的嵌套类/接口 java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidclear()booleancontainsKey(Object key)Vget(Object key)intgetMaxCapacity()Vput(K key, V value)Vremove(Object key)voidsetMaxCapacity(int maxCapacity)intsize()-
从类继承的方法 java.util.LinkedHashMap
containsValue, entrySet, forEach, getOrDefault, keySet, replaceAll, values
-
从类继承的方法 java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, isEmpty, merge, putAll, putIfAbsent, remove, replace, replace
-
从类继承的方法 java.util.AbstractMap
equals, hashCode, toString
-
从接口继承的方法 java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, replace, replace
-
-
-
-
方法详细资料
-
containsKey
public boolean containsKey(Object key)
- 指定者:
containsKey在接口中Map<K,V>- 覆盖:
containsKey在类中HashMap<K,V>
-
getMaxCapacity
public int getMaxCapacity()
-
setMaxCapacity
public void setMaxCapacity(int maxCapacity)
-
-