K
- key typeV
- value typepublic class LRUByteLimitedHashtable<K,V> extends CapacityLimitedHashtable<K,V>
CapacityLimitedHashtable
that attempts to keep its contents to a specific size in memory by
ejecting least-recently-used items when reaching its maximum capacity. It allows any values, but values should be a
byte[] or implement the Sizeable interface for byte-size estimation to function.CapacityLimitedHashtable
,
Serialized FormConcurrentHashMap.KeySetView<K,V>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
LRUByteLimitedHashtable(long capacity) |
Modifier and Type | Method and Description |
---|---|
long |
getObjectSize(Object obj)
Estimates the size of the object in bytes.
|
currentSize, get, put, remove
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
public LRUByteLimitedHashtable(long capacity)
capacity
- Maximum capacity of this table in bytespublic long getObjectSize(Object obj)
obj
is a byte[], this returns its length; if it implements
Sizeable
this uses getSizeInCache()
. Returns 0 for all other objects.getObjectSize
in class CapacityLimitedHashtable<K,V>
obj
- Object to estimate the byte-size ofCopyright © 2020 Snowbound Software Corporation. All rights reserved.