Class AbstractEvictionPolicy

java.lang.Object
com.tangosol.util.Base
com.tangosol.net.cache.AbstractEvictionPolicy
All Implemented Interfaces:
ConfigurableCacheMap.EvictionPolicy, MapListener, EventListener

public abstract class AbstractEvictionPolicy extends Base implements ConfigurableCacheMap.EvictionPolicy, MapListener
An abstract base class for custom cache eviction policies.
Author:
jh 2005.12.14
  • Constructor Details

    • AbstractEvictionPolicy

      public AbstractEvictionPolicy()
  • Method Details

    • getName

      public String getName()
      Obtain the name of the eviction policy. This is intended to be human readable for use in a monitoring tool; examples include "LRU" and "LFU".
      Specified by:
      getName in interface ConfigurableCacheMap.EvictionPolicy
      Returns:
      the name of the eviction policy
    • entryInserted

      public void entryInserted(MapEvent evt)
      Invoked when a map entry has been inserted.
      Specified by:
      entryInserted in interface MapListener
      Parameters:
      evt - the MapEvent carrying the insert information
    • entryUpdated

      public void entryUpdated(MapEvent evt)
      Invoked when a map entry has been updated.
      Specified by:
      entryUpdated in interface MapListener
      Parameters:
      evt - the MapEvent carrying the update information
    • entryDeleted

      public void entryDeleted(MapEvent evt)
      Invoked when a map entry has been removed.
      Specified by:
      entryDeleted in interface MapListener
      Parameters:
      evt - the MapEvent carrying the delete information
    • entryUpdated

      public abstract void entryUpdated(ConfigurableCacheMap.Entry entry)
      This method is called to indicate that an entry has been either inserted or updated.
      Parameters:
      entry - the Entry that has been inserted or updated
    • ensureCache

      protected ConfigurableCacheMap ensureCache(MapEvent evt)
      Return the ConfigurableCacheMap that uses this eviction policy.

      If the ConfigurableCacheMap property has not been intialized, it is set to the ConfigurableCacheMap that raised the given event.

      Parameters:
      evt - the MapEvent raised by the ConfigurableCacheMap that uses this eviction policy
      Returns:
      the ConfigurableCacheMap that uses this eviction policy
    • getEntry

      protected ConfigurableCacheMap.Entry getEntry(MapEvent evt)
      Return the map entry associated with the given map event.
      Parameters:
      evt - a map event raised by the cache that uses this eviction policy
      Returns:
      the map entry associated with the given event
    • getCache

      protected ConfigurableCacheMap getCache()
      Return the ConfigurableCacheMap that uses this eviction policy. The ConfigurableCacheMap is set the first time a map event is processed by the eviction policy.
      Returns:
      the ConfigurableCacheMap or null if a map event has not yet been processed by this eviction policy