public static class Maps.BoundedLruCacheStrategy<K,V> extends Maps.CacheStrategy<K,V>
Maps.CacheMap
,
Maps.CacheStrategy
,
Serialized FormCANONICAL, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, NOT_CANONICAL, SOFT, STRONG, WEAK
Constructor and Description |
---|
Maps.BoundedLruCacheStrategy(int bound)
Constructs a bounded LRU (least recently used), canonical, cache
strategy of strongly-referenced values.
|
Maps.BoundedLruCacheStrategy(int bound,
int initialCapacity,
float loadFactor,
Maps.CacheMap.Canonicity canonicity,
Maps.CacheMap.Strength strength)
Constructs a bounded LRU (least recently used) cache strategy.
|
Maps.BoundedLruCacheStrategy(int bound,
Maps.CacheMap.Canonicity canonicity,
Maps.CacheMap.Strength strength)
Constructs a bounded LRU (least recently used) cache strategy.
|
Maps.BoundedLruCacheStrategy(int bound,
Maps.CacheMap.Strength strength)
Constructs a bounded LRU (least recently used), canonical cache strategy.
|
Modifier and Type | Method and Description |
---|---|
protected void |
entryAdded(Maps.CacheMap<K,V> map,
Maps.LinkedEntry<K,V> entry)
Invoked when a new entry is added to this map, when entries are added
by
Maps.AbstractHashMap.put(K, V) . |
createDefaultEntry, createEntry, createEvictedEntry, createSoftEntry, createWeakEntry, entryAccessed, entryChanged, entryEvicted, entryPurged, entryRemoved, getCanonicity, getDefaultStrength, getInitialCapacity, getLoadFactor, mapChanged, mapConstructed
public Maps.BoundedLruCacheStrategy(int bound)
maximumSize+1
and 1.0f
,
respectively, which ensures that the map will not have to resize before
reaching its maximum size.bound
- The maximum number of entries allowed in the cache.public Maps.BoundedLruCacheStrategy(int bound, Maps.CacheMap.Strength strength)
maximumSize+1
and 1.0f
, respectively, which ensures that the map will not
have to resize before reaching its maximum size.bound
- The maximum number of entries allowed in the cache.strength
- The strength of value references.public Maps.BoundedLruCacheStrategy(int bound, Maps.CacheMap.Canonicity canonicity, Maps.CacheMap.Strength strength)
maximumSize+1
and 1.0f
, respectively, which ensures that the map will not
have to resize before reaching its maximum size.bound
- The maximum number of entries allowed in the cache.canonicity
- The mapping type, canonical or not.strength
- The strength of value references.public Maps.BoundedLruCacheStrategy(int bound, int initialCapacity, float loadFactor, Maps.CacheMap.Canonicity canonicity, Maps.CacheMap.Strength strength)
bound
- The maximum number of entries allowed in the cache.initialCapacity
- The initial capacity (see Maps.CacheStrategy.DEFAULT_INITIAL_CAPACITY
).loadFactor
- The load factor (see Maps.CacheStrategy.DEFAULT_LOAD_FACTOR
).canonicity
- The mapping type, canonical or not.strength
- The strength of value references.protected void entryAdded(Maps.CacheMap<K,V> map, Maps.LinkedEntry<K,V> entry)
Maps.AbstractHashMap.put(K, V)
.
The Maps.CacheStrategy
implementation does nothing.
The Maps.BoundedLruCacheStrategy
implementation evicts the eldest
entry in the map if the size of the map after the add exceeds the
maximum size.entryAdded
in class Maps.CacheStrategy<K,V>