org.jboss.cache.eviction
Class BaseEvictionPolicy
java.lang.Object
org.jboss.cache.eviction.BaseEvictionPolicy
- All Implemented Interfaces:
- EvictionPolicy
- Direct Known Subclasses:
- ElementSizePolicy, ExpirationPolicy, FIFOPolicy, LFUPolicy, LRUPolicy, MRUPolicy
public abstract class BaseEvictionPolicy
- extends java.lang.Object
- implements EvictionPolicy
Base class implementation of EvictionPolicy and TreeCacheListener.
- Version:
- $Revision: 1.9 $
- Author:
- Ben Wang 2-2004, Daniel Huang - dhuang@jboss.org
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
cache_
protected CacheSPI cache_
BaseEvictionPolicy
public BaseEvictionPolicy()
evict
public void evict(Fqn fqn)
throws java.lang.Exception
- Evict the node under given Fqn from cache.
- Specified by:
evict in interface EvictionPolicy
- Parameters:
fqn - The fqn of a node in cache.
- Throws:
java.lang.Exception
setCache
public void setCache(CacheSPI cache)
- Description copied from interface:
EvictionPolicy
- Method called to set the cache in this implementation.
- Specified by:
setCache in interface EvictionPolicy
- Parameters:
cache - the cache to set
getCache
public CacheSPI getCache()
- Specified by:
getCache in interface EvictionPolicy
- Returns:
- the CacheSPI instance this eviction policy is configured to work on.
canIgnoreEvent
public boolean canIgnoreEvent(Fqn fqn,
NodeEventType eventType)
- Description copied from interface:
EvictionPolicy
- 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. It can also be used to filter
out certain
event types in which the particular
eviction algorithm has no interest.
If this method returns false then the event is processed normally
and eviction processing for the node continues. As a result, the event
will be added to the eviction region's event queue where
at some later point the particular algorithm of the eviction policy
can use it to decide whether to call EvictionPolicy.evict(Fqn).
If this method returns true, then the event is ignored and will not factor
in any subsequent eviction processing.
- Specified by:
canIgnoreEvent in interface EvictionPolicy
- Parameters:
fqn - The Fqn of the node associated with the event.eventType - the type of the event
- Returns:
true to ignore events of this type for this Fqn,
false to process events normally.