|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.cache.eviction.BaseEvictionAlgorithm
org.jboss.cache.eviction.BaseSortedEvictionAlgorithm
org.jboss.cache.eviction.LFUAlgorithm
public class LFUAlgorithm
Least Frequently Used algorithm for cache eviction. Note that this algorithm is not thread-safe.
This algorithm relies on maxNodes and minNodes to operate correctly. Eviction takes place using Least Frequently Used algorithm. A node A that is used less than a node B is evicted sooner. The minNodes property defines a threshold for eviction. If minNodes = 100, the LFUAlgorithm will not evict the cache to anything less than 100 elements still left in cache. The maxNodes property defines the maximum number of nodes the cache will accept before eviction. maxNodes = 0 means that this region is unbounded. minNodes = 0 means that the eviction queue will attempt to bring the cache of this region to 0 elements (evict all elements) whenever it is run. This algorithm uses a sorted eviction queue. The eviction queue is sorted in ascending order based on the number of times a node is visited. The more frequently a node is visited, the less likely it will be evicted.
Field Summary |
---|
Fields inherited from class org.jboss.cache.eviction.BaseEvictionAlgorithm |
---|
allowTombstones, cache, configuration, evictionActionPolicy, evictionAlgorithmConfig, evictionQueue, recycleQueue, regionFqn |
Constructor Summary | |
---|---|
LFUAlgorithm()
|
Method Summary | |
---|---|
java.lang.Class<? extends EvictionAlgorithmConfig> |
getConfigurationClass()
This is a helper so that the XML parser will be able to select and use the correct EvictionAlgorithmConfig implementation
class corresponding to this EvictionAlgorithm. |
protected void |
prune()
|
protected EvictionQueue |
setupEvictionQueue()
Will create a LFUQueue to be used as the underlying eviction queue. |
protected boolean |
shouldEvictNode(NodeEntry ne)
This method will check whether the given node should be evicted or not. |
Methods inherited from class org.jboss.cache.eviction.BaseSortedEvictionAlgorithm |
---|
processQueues, resortEvictionQueue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LFUAlgorithm()
Method Detail |
---|
protected boolean shouldEvictNode(NodeEntry ne)
BaseEvictionAlgorithm
shouldEvictNode
in class BaseEvictionAlgorithm
ne
- NodeEntry to test eviction for.
protected EvictionQueue setupEvictionQueue() throws EvictionException
setupEvictionQueue
in class BaseEvictionAlgorithm
EvictionException
EvictionQueue
protected void prune() throws EvictionException
prune
in class BaseEvictionAlgorithm
EvictionException
public java.lang.Class<? extends EvictionAlgorithmConfig> getConfigurationClass()
EvictionAlgorithm
EvictionAlgorithmConfig
implementation
class corresponding to this EvictionAlgorithm. E.g., the FIFOAlgorithm
would return FIFOAlgorithmConfig
.class.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |