org.ehcache.core.events
Class CacheEvents

java.lang.Object
  extended by org.ehcache.core.events.CacheEvents

public final class CacheEvents
extends java.lang.Object

Utility class for the creation of CacheEvent instances.


Method Summary
static
<K,V> CacheEvent<K,V>
creation(K newKey, V newValue, Cache<K,V> source)
          Creates a created CacheEvent.
static
<K,V> CacheEvent<K,V>
eviction(K evictedKey, V evictedValue, Cache<K,V> source)
          Creates an evicted CacheEvent.
static
<K,V> CacheEvent<K,V>
expiry(K expiredKey, V expiredValue, Cache<K,V> source)
          Creates an expired CacheEvent.
static
<K,V> CacheEvent<K,V>
removal(K removedKey, V removedValue, Cache<K,V> source)
          Creates a removed CacheEvent.
static
<K,V> CacheEvent<K,V>
update(K key, V oldValue, V newValue, Cache<K,V> source)
          Creates an updated CacheEvent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

expiry

public static <K,V> CacheEvent<K,V> expiry(K expiredKey,
                                           V expiredValue,
                                           Cache<K,V> source)
Creates an expired CacheEvent.

Type Parameters:
K - the key type
V - the value type
Parameters:
expiredKey - the key for which the mapping expired
expiredValue - the expired value
source - the event source
Returns:
an expiry cache event

eviction

public static <K,V> CacheEvent<K,V> eviction(K evictedKey,
                                             V evictedValue,
                                             Cache<K,V> source)
Creates an evicted CacheEvent.

Type Parameters:
K - the key type
V - the value type
Parameters:
evictedKey - the key for which the mapping was evicted
evictedValue - the evicted value
source - the event source
Returns:
an evicted cache event

creation

public static <K,V> CacheEvent<K,V> creation(K newKey,
                                             V newValue,
                                             Cache<K,V> source)
Creates a created CacheEvent.

Type Parameters:
K - the key type
V - the value type
Parameters:
newKey - the new key
newValue - the new value
source - the event source
Returns:
a created cache event

removal

public static <K,V> CacheEvent<K,V> removal(K removedKey,
                                            V removedValue,
                                            Cache<K,V> source)
Creates a removed CacheEvent.

Type Parameters:
K - the key type
V - the value type
Parameters:
removedKey - the removed key
removedValue - the removed value
source - the event source
Returns:
a removed cache event

update

public static <K,V> CacheEvent<K,V> update(K key,
                                           V oldValue,
                                           V newValue,
                                           Cache<K,V> source)
Creates an updated CacheEvent.

Type Parameters:
K - the key type
V - the value type
Parameters:
key - the key for which the mapping was updated
oldValue - the old value
newValue - the new value
source - the event source
Returns:
an updated cache event