org.objectweb.perseus.cache.replacement.api
Interface ReplacementManager

All Superinterfaces:
UnbindManager
All Known Implementing Classes:
AbstractReplacementManager

public interface ReplacementManager
extends UnbindManager

It defines the commun methods associated to ReplacementManager implementations. Every Cache must have a ReplacementManager. The role of a ReplacementManager is to chose a set of objects to be evicted from the cache, whenever cache space is needed (e.g. to store a recently arrived object). Typical implementations for ReplacementManagers include LRU, MRU, FIFO based.

Author:
Luciano Garcia-Banuelos (Luciano.Garcia@imag.fr)

Method Summary
 void addForReplacement(FixableCacheEntry entry)
           
 void adjustForReplacement(FixableCacheEntry entry)
          Called whenever an object has been accessed.
 int forceFree(int capacity)
          It forces the replacement manager to free CacheEntry instances from the cahce.
 void removeForReplacement(java.lang.Object oid)
          This method is called by the CacheManager in order to signal that an entry has been really evicted.
 
Methods inherited from interface org.objectweb.perseus.cache.api.UnbindManager
unbind, unbind, unbindAll, unbindUnfixed
 

Method Detail

addForReplacement

public void addForReplacement(FixableCacheEntry entry)
                       throws CacheException
Parameters:
entry - The cache entry that has been accessed.
Throws:
CacheException - Whenever an internal error occurs.

removeForReplacement

public void removeForReplacement(java.lang.Object oid)
This method is called by the CacheManager in order to signal that an entry has been really evicted. In fact the eviction has been previously requested by the ReplacementManager, and now the GC garbaged an entry.

Parameters:
oid - is the evicted cache entry

adjustForReplacement

public void adjustForReplacement(FixableCacheEntry entry)
                          throws CacheException
Called whenever an object has been accessed. Thus, this method, gives hints about recency/frequency of use. This hints are used within the replacement algorithm.

Parameters:
entry - The cache entry that has been accessed.
Throws:
CacheException - Whenever an internal error occurs.

forceFree

public int forceFree(int capacity)
              throws CacheException
It forces the replacement manager to free CacheEntry instances from the cahce.

Parameters:
capacity - is the quantity of space required by the cache.
Throws:
CacheException


Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.