com.alachisoft.jvcache.event
Interface CacheListener

All Superinterfaces:
java.util.EventListener

public interface CacheListener
extends java.util.EventListener

The listener interface for receiving "interesting" cache events (item added, item upadted, item removed and cleared) in the cache.

The class that is interested in processing a cache event either implements this interface (and all the methods it contains) or extends the abstract CacheAdapter class (overriding only the methods of interest).

The listener object created from that class is then registered with a component using the component's addCacheListener method. A cache event is generated when an item is added, updated, removed from the cache.. A cache event is also generated when the cache is cleared. When a cache event occurs, the relevant method in the listener object is invoked, and the CacheEvent is passed to it.

See Also:
CacheAdapter, CacheEvent

Method Summary
 void cacheCleared()
          Invoked when the cache contents are cleared.
 void cacheItemAdded(CacheEvent cacheEvent)
          Invoked when an item is added in the cache.
 void cacheItemRemoved(CacheEvent cacheEvent)
          Invoked when an item in the cache is removed.
 void cacheItemUpdated(CacheEvent cacheEvent)
          Invoked when an item is updated in the cache.
 

Method Detail

cacheCleared

void cacheCleared()
Invoked when the cache contents are cleared.


cacheItemAdded

void cacheItemAdded(CacheEvent cacheEvent)
Invoked when an item is added in the cache.

Parameters:
cacheEvent - Contains the CacheEvent details.

cacheItemRemoved

void cacheItemRemoved(CacheEvent cacheEvent)
Invoked when an item in the cache is removed.

Parameters:
cacheEvent - Contains the event details.

cacheItemUpdated

void cacheItemUpdated(CacheEvent cacheEvent)
Invoked when an item is updated in the cache.

Parameters:
cacheEvent - Contains the event details.