com.alachisoft.jvcache.event
Class CacheEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.alachisoft.jvcache.event.CacheEvent
All Implemented Interfaces:
java.io.Serializable

public class CacheEvent
extends java.util.EventObject

CacheEvent is used to notify interested parties that something has happened with respect to a cache.

See Also:
Serialized Form

Nested Class Summary
static class CacheEvent.EventType
          Defines the ADDED, UPDATED, REMOVED and CLEARED event types, along with their string representations, returned by toString().
 
Constructor Summary
CacheEvent(java.lang.Object source, CacheEvent.EventType type, java.lang.String key)
          Creates a new object representing a cache event.
CacheEvent(java.lang.Object source, CacheEvent.EventType type, java.lang.String key, java.lang.Object value)
          Creates a new object representing a cache event.
CacheEvent(java.lang.Object source, CacheEvent.EventType type, java.lang.String key, java.lang.Object value, CacheItemRemovedReason reason)
          Creates a new object representing a cache event.
 
Method Summary
 CacheEvent.EventType getEventType()
          Gets the type of event.
 java.lang.String getKey()
          Returns the Key of the item for which this event occured.
 CacheItemRemovedReason getRemoveReason()
          Returns the remove reason for the Reamve Event.
 java.lang.Object getValue()
          Returns the Value of the item for which this event occured.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CacheEvent

public CacheEvent(java.lang.Object source,
                  CacheEvent.EventType type,
                  java.lang.String key)
Creates a new object representing a cache event.

Parameters:
source - the cache object responsible for the event
type - the event type
key - the key of the item added.

CacheEvent

public CacheEvent(java.lang.Object source,
                  CacheEvent.EventType type,
                  java.lang.String key,
                  java.lang.Object value)
Creates a new object representing a cache event.

Parameters:
source - the cache object responsible for the event
type - the event type
key - the key of the item added.
value - the value of the item added.

CacheEvent

public CacheEvent(java.lang.Object source,
                  CacheEvent.EventType type,
                  java.lang.String key,
                  java.lang.Object value,
                  CacheItemRemovedReason reason)
Creates a new object representing a cache event.

Parameters:
source - the cache object responsible for the event
type - the event type
key - the key of the item added.
value - the value of the item added.
reason - the reason for the removal of the item from the cache.
See Also:
CacheItemRemovedReason
Method Detail

getEventType

public CacheEvent.EventType getEventType()
Gets the type of event.

Returns:
the type

getKey

public java.lang.String getKey()
Returns the Key of the item for which this event occured.

Returns:
Returns the Key of the item for which this event occured.

getValue

public java.lang.Object getValue()
Returns the Value of the item for which this event occured.

Returns:
Returns the Value of the item for which this event occured.

getRemoveReason

public CacheItemRemovedReason getRemoveReason()
Returns the remove reason for the Reamve Event.

Returns:
Returns the remove reason for the Reamve Event.