org.jboss.cache.eviction
Class LRUAlgorithm

java.lang.Object
  extended by org.jboss.cache.eviction.BaseEvictionAlgorithm
      extended by org.jboss.cache.eviction.LRUAlgorithm
All Implemented Interfaces:
EvictionAlgorithm
Direct Known Subclasses:
AopLRUAlgorithm

public class LRUAlgorithm
extends BaseEvictionAlgorithm
implements EvictionAlgorithm

Least recently Used algorithm to purge old data. Note that this algorithm is not thread-safe.

Author:
Ben Wang 02-2004, Daniel Huang - dhuang@jboss.org

Field Summary
 
Fields inherited from class org.jboss.cache.eviction.BaseEvictionAlgorithm
evictionQueue, recycleQueue, region
 
Constructor Summary
LRUAlgorithm()
           
 
Method Summary
protected  void evict(NodeEntry ne)
           
protected  LRUConfiguration getConfiguration()
           
protected  void prune()
           
protected  EvictionQueue setupEvictionQueue(Region region)
          This method will create an EvictionQueue implementation and prepare it for use.
protected  boolean shouldEvictNode(NodeEntry entry)
          This method will check whether the given node should be evicted or not.
 
Methods inherited from class org.jboss.cache.eviction.BaseEvictionAlgorithm
emptyRecycleQueue, evictCacheNode, getEvictionQueue, initialize, isNodeInUseAndNotTimedOut, process, processAddedElement, processAddedNodes, processMarkInUseNodes, processQueues, processRemovedElement, processRemovedNodes, processUnmarkInUseNodes, processVisitedNodes, resetEvictionQueue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.eviction.EvictionAlgorithm
getEvictionQueue, process, resetEvictionQueue
 

Constructor Detail

LRUAlgorithm

public LRUAlgorithm()
Method Detail

setupEvictionQueue

protected EvictionQueue setupEvictionQueue(Region region)
                                    throws EvictionException
Description copied from class: BaseEvictionAlgorithm
This method will create an EvictionQueue implementation and prepare it for use.

Specified by:
setupEvictionQueue in class BaseEvictionAlgorithm
Parameters:
region - Region to setup an eviction queue for.
Returns:
The created EvictionQueue to be used as the eviction queue for this algorithm.
Throws:
EvictionException
See Also:
EvictionQueue

shouldEvictNode

protected boolean shouldEvictNode(NodeEntry entry)
Description copied from class: BaseEvictionAlgorithm
This method will check whether the given node should be evicted or not.

Specified by:
shouldEvictNode in class BaseEvictionAlgorithm
Parameters:
entry - NodeEntry to test eviction for.
Returns:
True if the given node should be evicted. False if the given node should not be evicted.

evict

protected void evict(NodeEntry ne)
Overrides:
evict in class BaseEvictionAlgorithm

prune

protected void prune()
              throws EvictionException
Overrides:
prune in class BaseEvictionAlgorithm
Throws:
EvictionException

getConfiguration

protected LRUConfiguration getConfiguration()


Copyright 1998-2005 JBoss Inc . All Rights Reserved.