org.jboss.cache.eviction
Interface EvictionPolicy

All Known Implementing Classes:
AopLRUPolicy, BaseEvictionPolicy, ElementSizePolicy, FIFOPolicy, LFUPolicy, LRUPolicy, MRUPolicy

public interface EvictionPolicy

Generic eviction policy interface.

None of the Eviction classes are thread safe. It is assumed that an individual instance of an EvictionPolicy/ EvictionAlgorithm/EvictionQueue/EvictionConfiguration are only operated on by one thread at any given time.

Author:
Ben Wang 2-2004, Daniel Huang - dhuang@jboss.org - 10/2005

Method Summary
 boolean canIgnoreEvent(Fqn fqn)
          This method will be invoked prior to an event being processed for a node with the specified Fqn.
 void configure(TreeCache cache)
          Method called to configure this implementation.
 void evict(Fqn fqn)
          Evict a node form the underlying cache.
 java.lang.Object getCacheData(Fqn fqn, java.lang.Object key)
           
 java.util.Set getChildrenNames(Fqn fqn)
          Return children names as Objects
 EvictionAlgorithm getEvictionAlgorithm()
          Get the associated EvictionAlgorithm used by the EvictionPolicy.
 java.lang.Class getEvictionConfigurationClass()
          The EvictionConfiguration implementation class used by this EvictionPolicy.
 boolean hasChild(Fqn fqn)
          Is this a leaf node?
 

Method Detail

evict

void evict(Fqn fqn)
           throws java.lang.Exception
Evict a node form the underlying cache.

Parameters:
fqn - DataNode corresponds to this fqn.
Throws:
java.lang.Exception

getChildrenNames

java.util.Set getChildrenNames(Fqn fqn)
Return children names as Objects

Parameters:
fqn -
Returns:
Child names under given fqn

hasChild

boolean hasChild(Fqn fqn)
Is this a leaf node?

Parameters:
fqn -
Returns:
true/false if leaf node.

getCacheData

java.lang.Object getCacheData(Fqn fqn,
                              java.lang.Object key)

configure

void configure(TreeCache cache)
Method called to configure this implementation.


getEvictionAlgorithm

EvictionAlgorithm getEvictionAlgorithm()
Get the associated EvictionAlgorithm used by the EvictionPolicy.

This relationship should be 1-1.

Returns:
An EvictionAlgorithm implementation.

getEvictionConfigurationClass

java.lang.Class getEvictionConfigurationClass()
The EvictionConfiguration implementation class used by this EvictionPolicy.

Returns:
EvictionConfiguration implementation class.

canIgnoreEvent

boolean canIgnoreEvent(Fqn fqn)
This method will be invoked prior to an event being processed for a node with the specified Fqn.

This method provides a way to optimize the performance of eviction by signalling that the node associated with the specified Fqn should not be subject to normal eviction processing.

If this method returns false then then event is processed normally and eviction processing for the node continues. As a result, EvictionPolicy.evict() may be invoked at some later point based on the particular algorirthm of the eviction policy.

If this method returns true, then the event is ignored and eviction processing is bypassed for this node. As a result, EvictionPolicy.evict() will never be invoked for this node.

Parameters:
fqn - The Fqn of the node associated with the event.
Returns:
true to ignore events for this Fqn. false to process events normally.


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.