net.sf.farrago.util
Interface FarragoCacheVictimPolicy

All Known Implementing Classes:
FarragoLruVictimPolicy

public interface FarragoCacheVictimPolicy

FarragoCacheVictimPolicy defines the interface for different implementations of a cache victimization policy for the FarragoObjectCache. FarragoObjectCache calls the appropriate notification methods when entries are added, removed, or accessed from the cache, allowing the policy to determine the order in which entries should be victimized from the cache, when the cache becomes full.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/util/FarragoCacheVictimPolicy.java#6 $
Author:
Zelaine Fong

Method Summary
 void accessEntry(FarragoCacheEntry entry)
          Receives notification that an existing entry in the cache is being accessed.
 void clearCache()
          Receives notification that all entries are being removed from the cache
 Iterator<FarragoCacheEntry> getVictimIterator()
          Returns an iterator corresponding to a list of potential entries for removal from the cache, in the order of precedence.
 FarragoCacheEntry newEntry(FarragoObjectCache parentCache)
          Creates a new cache entry
 void registerEntry(FarragoCacheEntry entry)
          Receives notification that a new entry is being added to the cache.
 void unregisterEntry(FarragoCacheEntry entry)
          Receives notification that an entry is being removed from the cache.
 void unregisterEntry(Iterator victimRange)
          Unregisters the current entry being accessed from the victim range
 

Method Detail

newEntry

FarragoCacheEntry newEntry(FarragoObjectCache parentCache)
Creates a new cache entry

Parameters:
parentCache - the cache this entry is associated with

registerEntry

void registerEntry(FarragoCacheEntry entry)
Receives notification that a new entry is being added to the cache.

Parameters:
entry - new entry being added to the cache

unregisterEntry

void unregisterEntry(FarragoCacheEntry entry)
Receives notification that an entry is being removed from the cache.

Parameters:
entry - entry to be removed

unregisterEntry

void unregisterEntry(Iterator victimRange)
Unregisters the current entry being accessed from the victim range

Parameters:
victimRange - iterator corresponding to the victim range

accessEntry

void accessEntry(FarragoCacheEntry entry)
Receives notification that an existing entry in the cache is being accessed.

Parameters:
entry - entry being accessed

getVictimIterator

Iterator<FarragoCacheEntry> getVictimIterator()
Returns an iterator corresponding to a list of potential entries for removal from the cache, in the order of precedence.

Returns:
iterator corresponding to cache victims

clearCache

void clearCache()
Receives notification that all entries are being removed from the cache