org.jboss.cache.eviction
Class LRUPolicy

java.lang.Object
  extended byorg.jboss.cache.eviction.BaseEvictionPolicy (src) 
      extended byorg.jboss.cache.eviction.LRUPolicy
All Implemented Interfaces:
EvictionPolicy (src) , TreeCacheListener (src)
Direct Known Subclasses:
AopLRUPolicy (src) , FIFOPolicy (src)

public class LRUPolicy
extends BaseEvictionPolicy (src)
implements TreeCacheListener (src)

Provider to provide eviction policy. This one is based on LRU algorithm that a user can specify either maximum number of nodes or the idle time of a node to be evicted.


Field Summary
protected  Logger (src) log_
           
 
Fields inherited from class org.jboss.cache.eviction.BaseEvictionPolicy (src)
cache_, regionManager_
 
Constructor Summary
LRUPolicy()
           
 
Method Summary
 void cacheStarted(TreeCache (src)  cache)
          Called when the cache is started.
 void cacheStopped(TreeCache (src)  cache)
          Called when the cache is stopped.
 void configure(TreeCache (src)  cache)
          Method called to configure this implementation.
protected  EvictionAlgorithm (src) getEvictionAlgorithm()
           
 int getWakeupIntervalSeconds()
          return eviction thread (if any) wake up interval in seconds.
 void nodeAdded(Fqn (src)  fqn)
          --- Implementation of TreeCacheListener interface ---
 void nodeCreated(Fqn (src)  fqn)
          Called when a node is created
 void nodeEvicted(Fqn (src)  fqn)
          Called when a node is evicted (not the same as remove()).
 void nodeLoaded(Fqn (src)  fqn)
          Called when a node is loaded into memory via the CacheLoader.
 void nodeModified(Fqn (src)  fqn)
          Called when a node is modified, e.g., one (key, value) pair in the internal map storage has been modified.
 void nodeRemoved(Fqn (src)  fqn)
          Note that this removes all children nodes as well.
 void nodeVisited(Fqn (src)  fqn)
          Called when a node is visisted, i.e., get().
 void viewChange(View new_view)
           
 
Methods inherited from class org.jboss.cache.eviction.BaseEvictionPolicy (src)
evict, getCacheData, getChildrenNames, getRegions, hasChild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log_

protected Logger (src)  log_
Constructor Detail

LRUPolicy

public LRUPolicy()
Method Detail

nodeAdded

public void nodeAdded(Fqn (src)  fqn)
--- Implementation of TreeCacheListener interface ---


nodeRemoved

public void nodeRemoved(Fqn (src)  fqn)
Note that this removes all children nodes as well. So we will need to put the children nodes into removed queue.

Specified by:
nodeRemoved in interface TreeCacheListener (src)
Parameters:
fqn -

nodeEvicted

public void nodeEvicted(Fqn (src)  fqn)
Description copied from interface: TreeCacheListener (src)
Called when a node is evicted (not the same as remove()).

Specified by:
nodeEvicted in interface TreeCacheListener (src)
Parameters:
fqn -

nodeModified

public void nodeModified(Fqn (src)  fqn)
Description copied from interface: TreeCacheListener (src)
Called when a node is modified, e.g., one (key, value) pair in the internal map storage has been modified.

Specified by:
nodeModified in interface TreeCacheListener (src)
Parameters:
fqn -

nodeLoaded

public void nodeLoaded(Fqn (src)  fqn)
Description copied from interface: TreeCacheListener (src)
Called when a node is loaded into memory via the CacheLoader. This is not the same as TreeCacheListener.nodeCreated(Fqn).

Specified by:
nodeLoaded in interface TreeCacheListener (src)

nodeCreated

public void nodeCreated(Fqn (src)  fqn)
Description copied from interface: TreeCacheListener (src)
Called when a node is created

Specified by:
nodeCreated in interface TreeCacheListener (src)
Parameters:
fqn -

nodeVisited

public void nodeVisited(Fqn (src)  fqn)
Description copied from interface: TreeCacheListener (src)
Called when a node is visisted, i.e., get().

Specified by:
nodeVisited in interface TreeCacheListener (src)
Parameters:
fqn -

cacheStarted

public void cacheStarted(TreeCache (src)  cache)
Description copied from interface: TreeCacheListener (src)
Called when the cache is started.

Specified by:
cacheStarted in interface TreeCacheListener (src)
Parameters:
cache -

getEvictionAlgorithm

protected EvictionAlgorithm (src)  getEvictionAlgorithm()

cacheStopped

public void cacheStopped(TreeCache (src)  cache)
Description copied from interface: TreeCacheListener (src)
Called when the cache is stopped.

Specified by:
cacheStopped in interface TreeCacheListener (src)
Parameters:
cache -

viewChange

public void viewChange(View new_view)
Specified by:
viewChange in interface TreeCacheListener (src)

getWakeupIntervalSeconds

public int getWakeupIntervalSeconds()
Description copied from interface: EvictionPolicy (src)
return eviction thread (if any) wake up interval in seconds.

Specified by:
getWakeupIntervalSeconds in interface EvictionPolicy (src)
Overrides:
getWakeupIntervalSeconds in class BaseEvictionPolicy (src)

configure

public void configure(TreeCache (src)  cache)
Description copied from interface: EvictionPolicy (src)
Method called to configure this implementation.

Specified by:
configure in interface EvictionPolicy (src)
Overrides:
configure in class BaseEvictionPolicy (src)