static final class BoundedConcurrentHashMap.LIRS<K,V> extends Object implements BoundedConcurrentHashMap.EvictionPolicy<K,V>
| Modifier and Type | Field and Description |
|---|---|
private ConcurrentLinkedQueue<BoundedConcurrentHashMap.LIRSHashEntry<K,V>> |
accessQueue
The accessQueue for reducing lock contention
See "BP-Wrapper: a system framework making any replacement algorithms
(almost) lock contention free"
http://www.cse.ohio-state.edu/hpcs/WWW/HTML/publications/abs09-1.html
|
private float |
batchThresholdFactor |
private BoundedConcurrentHashMap.LIRSHashEntry<K,V> |
header
This header encompasses two data structures:
The LIRS stack, S, which is maintains recency information.
|
private int |
hotSize
The actual number of hot entries.
|
private static float |
L_LIRS
The percentage of the cache which is dedicated to hot blocks.
|
private int |
maxBatchQueueSize
The maxBatchQueueSize
See "BP-Wrapper: a system framework making any replacement algorithms (almost) lock
contention free"
|
private int |
maximumHotSize
The maximum number of hot entries (L_lirs in the paper).
|
private int |
maximumSize
The maximum number of resident entries (L in the paper).
|
private BoundedConcurrentHashMap.Segment<K,V> |
segment
The owning segment
|
private int |
size
The number of LIRS entries in a segment
|
MAX_BATCH_SIZE| Constructor and Description |
|---|
LIRS(BoundedConcurrentHashMap.Segment<K,V> s,
int capacity,
int maxBatchSize,
float batchThresholdFactor) |
| Modifier and Type | Method and Description |
|---|---|
private static int |
calculateLIRSize(int maximumSize) |
void |
clear()
Invoked to notify EvictionPolicy implementation that all Segment entries have been
cleared.
|
BoundedConcurrentHashMap.HashEntry<K,V> |
createNewEntry(K key,
int hash,
BoundedConcurrentHashMap.HashEntry<K,V> next,
V value) |
Set<BoundedConcurrentHashMap.HashEntry<K,V>> |
execute()
Invokes eviction policy algorithm and returns set of evicted entries.
|
boolean |
onEntryHit(BoundedConcurrentHashMap.HashEntry<K,V> e)
Invoked to notify EvictionPolicy implementation that an entry in Segment has been
accessed.
|
Set<BoundedConcurrentHashMap.HashEntry<K,V>> |
onEntryMiss(BoundedConcurrentHashMap.HashEntry<K,V> en)
Invoked to notify EvictionPolicy implementation that there has been an attempt to access
an entry in Segment, however that entry was not present in Segment.
|
void |
onEntryRemove(BoundedConcurrentHashMap.HashEntry<K,V> e)
Invoked to notify EvictionPolicy implementation that an entry e has been removed from
Segment.
|
private void |
pruneStack(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted)
Prunes HIR blocks in the bottom of the stack until an HOT block sits in
the stack bottom.
|
private BoundedConcurrentHashMap.LIRSHashEntry<K,V> |
queueEnd()
Returns the entry at the end of the queue.
|
private BoundedConcurrentHashMap.LIRSHashEntry<K,V> |
queueFront()
Returns the entry at the front of the queue.
|
private void |
removeFromSegment(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted) |
private BoundedConcurrentHashMap.LIRSHashEntry<K,V> |
stackBottom()
Returns the entry at the bottom of the stack.
|
BoundedConcurrentHashMap.Eviction |
strategy()
Returns type of eviction algorithm (strategy).
|
boolean |
thresholdExpired()
Returns true if batching threshold has expired, false otherwise.
|
private static final float L_LIRS
private final BoundedConcurrentHashMap.Segment<K,V> segment
private final ConcurrentLinkedQueue<BoundedConcurrentHashMap.LIRSHashEntry<K,V>> accessQueue
private final int maxBatchQueueSize
private int size
private final float batchThresholdFactor
private final BoundedConcurrentHashMap.LIRSHashEntry<K,V> header
private final int maximumHotSize
private final int maximumSize
private int hotSize
public LIRS(BoundedConcurrentHashMap.Segment<K,V> s, int capacity, int maxBatchSize, float batchThresholdFactor)
private static int calculateLIRSize(int maximumSize)
public Set<BoundedConcurrentHashMap.HashEntry<K,V>> execute()
BoundedConcurrentHashMap.EvictionPolicyexecute in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>private void pruneStack(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted)
public Set<BoundedConcurrentHashMap.HashEntry<K,V>> onEntryMiss(BoundedConcurrentHashMap.HashEntry<K,V> en)
BoundedConcurrentHashMap.EvictionPolicyonEntryMiss in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>en - accessed entry in Segmentprivate void removeFromSegment(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted)
public boolean onEntryHit(BoundedConcurrentHashMap.HashEntry<K,V> e)
BoundedConcurrentHashMap.EvictionPolicyonEntryHit in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>e - accessed entry in Segmentpublic boolean thresholdExpired()
BoundedConcurrentHashMap.EvictionPolicythresholdExpired in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>public void onEntryRemove(BoundedConcurrentHashMap.HashEntry<K,V> e)
BoundedConcurrentHashMap.EvictionPolicyonEntryRemove in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>e - removed entry in Segmentpublic void clear()
BoundedConcurrentHashMap.EvictionPolicyclear in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>public BoundedConcurrentHashMap.Eviction strategy()
BoundedConcurrentHashMap.EvictionPolicystrategy in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>private BoundedConcurrentHashMap.LIRSHashEntry<K,V> stackBottom()
private BoundedConcurrentHashMap.LIRSHashEntry<K,V> queueFront()
private BoundedConcurrentHashMap.LIRSHashEntry<K,V> queueEnd()
public BoundedConcurrentHashMap.HashEntry<K,V> createNewEntry(K key, int hash, BoundedConcurrentHashMap.HashEntry<K,V> next, V value)
createNewEntry in interface BoundedConcurrentHashMap.EvictionPolicy<K,V>Copyright © 2020 JBoss by Red Hat. All rights reserved.