Package com.snowbound.common.utils
Class LRUHashtable<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.concurrent.ConcurrentHashMap<K,V>
-
- com.snowbound.common.utils.CapacityLimitedHashtable<K,V>
-
- com.snowbound.common.utils.LRUHashtable<K,V>
-
- Type Parameters:
K
- key typeV
- value type
- All Implemented Interfaces:
java.io.Serializable
,java.util.concurrent.ConcurrentMap<K,V>
,java.util.Map<K,V>
public class LRUHashtable<K,V> extends CapacityLimitedHashtable<K,V>
Implementation ofCapacityLimitedHashtable
that only allows a specific number of entries before ejecting the least-recently-used items.- See Also:
CapacityLimitedHashtable
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ConcurrentHashMap
java.util.concurrent.ConcurrentHashMap.KeySetView<K extends java.lang.Object,V extends java.lang.Object>
-
-
Constructor Summary
Constructors Constructor Description LRUHashtable(long max)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getObjectSize(java.lang.Object obj)
Always returns 1; this makes capacity a measure of the number of items in the table.-
Methods inherited from class com.snowbound.common.utils.CapacityLimitedHashtable
currentSize, get, put, remove
-
Methods inherited from class java.util.concurrent.ConcurrentHashMap
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, values
-
-
-
-
Method Detail
-
getObjectSize
public long getObjectSize(java.lang.Object obj)
Always returns 1; this makes capacity a measure of the number of items in the table.- Specified by:
getObjectSize
in classCapacityLimitedHashtable<K,V>
- Parameters:
obj
- object to size; since this always returns 1 its value does not matter- Returns:
- always returns 1
-
-