T
- type of store handled by this evictorpublic abstract class AbstractBalancedAccessEvictor<T> extends java.lang.Object implements PoolEvictor<T>
Modifier and Type | Class and Description |
---|---|
private class |
AbstractBalancedAccessEvictor.EvictionCostComparator
Comparator used to rank the stores in order of eviction 'cost'.
|
Modifier and Type | Field and Description |
---|---|
private static double |
ALPHA |
private static int |
SAMPLE_SIZE |
Constructor and Description |
---|
AbstractBalancedAccessEvictor() |
Modifier and Type | Method and Description |
---|---|
protected abstract long |
byteSize(T store)
Return the size in bytes of the supplied store.
|
protected abstract long |
countSize(T store)
Return the number of mappings in the supplied store.
|
protected abstract boolean |
evict(T store,
int count,
long bytes)
Evict the specified number of bytes or the hinted number of elements from the specified store
|
private float |
evictionCost(T store,
long unloadedSize) |
boolean |
freeSpace(java.util.Collection<T> from,
long bytes)
Free at least N bytes from a collection of resources
|
private long |
getDesiredUnloadedSize(java.util.Collection<T> from) |
private static float |
hitDistributionFunction(float fillLevel) |
protected abstract float |
hitRate(T store)
Return the hit rate for the supplied store.
|
protected abstract float |
missRate(T store)
Return the miss rate for the supplied store.
|
private static final double ALPHA
private static final int SAMPLE_SIZE
protected abstract boolean evict(T store, int count, long bytes)
store
- store to evict fromcount
- number of elements to evictbytes
- number of bytes to evicttrue
if the eviction succeededprotected abstract float hitRate(T store)
store
- store to queryprotected abstract float missRate(T store)
store
- store to queryprotected abstract long countSize(T store)
store
- store to sizeprotected abstract long byteSize(T store)
store
- store to sizepublic boolean freeSpace(java.util.Collection<T> from, long bytes)
freeSpace
in interface PoolEvictor<T>
from
- a collection of resources to free frombytes
- the number of bytes to free upprivate float evictionCost(T store, long unloadedSize)
private static float hitDistributionFunction(float fillLevel)
private long getDesiredUnloadedSize(java.util.Collection<T> from)