Class CacheEventArgs
An event which indicates that the content of a cache has changed.
Inherited Members
Namespace: Tangosol.Net.Cache
Assembly: Coherence.dll
Syntax
[Serializable]
public class CacheEventArgs
Remarks
Possible cache changes that can be respresented by this class are:
- an entry has been added
- an entry has been removed
- an entry has been changed
A CacheEventArgs object is sent as an argument to the
ICacheListener interface methods. null
values may be provided for the old and the new values.
Not all cache service types support the dispatching of synthetic events. Synthetic events will only be dispatched by a partitioned cache service and its derivatives, such as a federated cache service, or by near, view, or remote caches that are backed by a cache service that supports the dispatching of synthetic events. In all other cases, no event will be dispatched for synthetic events such as expiry.
Constructors
CacheEventArgs(IObservableCache, CacheEventType, object, object, object, bool)
Constructs a new CacheEventArgs.
Declaration
public CacheEventArgs(IObservableCache source, CacheEventType eventType, object key, object valueOld, object valueNew, bool isSynthetic)
Parameters
Type | Name | Description |
---|---|---|
IObservableCache | source | The IObservableCache object that fired the event. |
CacheEventType | eventType | This event's type, one of CacheEventType values. |
object | key | The key into the cache. |
object | valueOld | The old value (for update and delete events). |
object | valueNew | The new value (for insert and update events). |
bool | isSynthetic | true if the event is caused by the cache internal processing such as eviction or loading. |
CacheEventArgs(IObservableCache, CacheEventType, object, object, object, bool, bool)
Constructs a new CacheEventArgs.
Declaration
public CacheEventArgs(IObservableCache source, CacheEventType eventType, object key, object valueOld, object valueNew, bool isSynthetic, bool isPriming)
Parameters
Type | Name | Description |
---|---|---|
IObservableCache | source | The IObservableCache object that fired the event. |
CacheEventType | eventType | This event's type, one of CacheEventType values. |
object | key | The key into the cache. |
object | valueOld | The old value (for update and delete events). |
object | valueNew | The new value (for insert and update events). |
bool | isSynthetic | true if the event is caused by the cache internal processing such as eviction or loading. |
bool | isPriming | true if the event is a priming event. |
CacheEventArgs(IObservableCache, CacheEventType, object, object, object, bool, TransformationState, bool)
Constructs a new CacheEventArgs.
Declaration
public CacheEventArgs(IObservableCache source, CacheEventType eventType, object key, object valueOld, object valueNew, bool isSynthetic, CacheEventArgs.TransformationState transformState, bool isPriming)
Parameters
Type | Name | Description |
---|---|---|
IObservableCache | source | The IObservableCache object that fired the event. |
CacheEventType | eventType | This event's type, one of CacheEventType values. |
object | key | The key into the cache. |
object | valueOld | The old value (for update and delete events). |
object | valueNew | The new value (for insert and update events). |
bool | isSynthetic | true if the event is caused by the cache internal processing such as eviction or loading. |
CacheEventArgs.TransformationState | transformState | true if the event is a priming event. has been or should be transformed. |
bool | isPriming | true if the event is a priming event. |
CacheEventArgs(IObservableCache, CacheEventType, object, object, object, bool, TransformationState, bool, bool)
Constructs a new CacheEventArgs.
Declaration
public CacheEventArgs(IObservableCache source, CacheEventType eventType, object key, object valueOld, object valueNew, bool isSynthetic, CacheEventArgs.TransformationState transformState, bool isPriming, bool isExpired)
Parameters
Type | Name | Description |
---|---|---|
IObservableCache | source | The IObservableCache object that fired the event. |
CacheEventType | eventType | This event's type, one of CacheEventType values. |
object | key | The key into the cache. |
object | valueOld | The old value (for update and delete events). |
object | valueNew | The new value (for insert and update events). |
bool | isSynthetic | true if the event is caused by the cache internal processing such as eviction or loading. |
CacheEventArgs.TransformationState | transformState | true if the event is a priming event. has been or should be transformed. |
bool | isPriming | true if the event is a priming event. |
bool | isExpired | true if the event is an expired event. |
Fields
m_eventType
The event's type.
Declaration
protected CacheEventType m_eventType
Field Value
Type | Description |
---|---|
CacheEventType |
m_isExpired
The expired event flag.
Declaration
protected bool m_isExpired
Field Value
Type | Description |
---|---|
bool |
m_isPriming
The priming event flag.
Declaration
protected bool m_isPriming
Field Value
Type | Description |
---|---|
bool |
m_isSynthetic
Event cause flag.
Declaration
protected bool m_isSynthetic
Field Value
Type | Description |
---|---|
bool |
m_key
A key.
Declaration
protected object m_key
Field Value
Type | Description |
---|---|
object |
m_source
The event's source.
Declaration
protected IObservableCache m_source
Field Value
Type | Description |
---|---|
IObservableCache |
m_transformState
The transformation state for this event
Declaration
protected CacheEventArgs.TransformationState m_transformState
Field Value
Type | Description |
---|---|
CacheEventArgs.TransformationState |
m_valueNew
A new value.
Declaration
protected object m_valueNew
Field Value
Type | Description |
---|---|
object |
Remarks
May be null
if not known.
m_valueOld
A previous value.
Declaration
protected object m_valueOld
Field Value
Type | Description |
---|---|
object |
Remarks
May be null
if not known.
Properties
Cache
Gets the IObservableCache object on which this event has actually occured.
Declaration
public virtual IObservableCache Cache { get; }
Property Value
Type | Description |
---|---|
IObservableCache | An IObservableCache object on which this event has occured. |
EventType
Gets this event's type.
Declaration
public virtual CacheEventType EventType { get; }
Property Value
Type | Description |
---|---|
CacheEventType | An event type. |
Remarks
The event type is one of the CacheEventType enumerated constants.
IsExpired
Return true if this event is an expired event.
Declaration
public virtual bool IsExpired { get; }
Property Value
Type | Description |
---|---|
bool | true if this event is an expired event. |
IsPriming
Return true if this event is a priming event.
Declaration
public virtual bool IsPriming { get; }
Property Value
Type | Description |
---|---|
bool | true if this event is a priming event. |
IsSynthetic
Return true if this event is caused by the cache internal processing such as eviction or loading.
Declaration
public virtual bool IsSynthetic { get; }
Property Value
Type | Description |
---|---|
bool | true if this event is caused by the cache internal processing. |
Key
Gets a key associated with this event.
Declaration
public virtual object Key { get; }
Property Value
Type | Description |
---|---|
object | A key. |
NewValue
Gets a new value associated with this event.
Declaration
public virtual object NewValue { get; }
Property Value
Type | Description |
---|---|
object | A new value. |
Remarks
The new value represents a new value inserted into or updated in
a dictionary. It is always null
for "delete" notifications.
OldValue
Gets an old value associated with this event.
Declaration
public virtual object OldValue { get; }
Property Value
Type | Description |
---|---|
object | An old value. |
Remarks
The old value represents a value deleted from or updated in a
dictionary. It is always null
for "insert" notifications.
TransformState
Return TransformationState for this event.
Declaration
public virtual CacheEventArgs.TransformationState TransformState { get; }
Property Value
Type | Description |
---|---|
CacheEventArgs.TransformationState | A TransformationState. |
Methods
Dispatch(ICacheListener)
Dispatch this event to the specified MapListener.
Declaration
public void Dispatch(ICacheListener listener)
Parameters
Type | Name | Description |
---|---|---|
ICacheListener | listener | The ICacheListener. |
GetDescription()
Get the event's description.
Declaration
protected virtual string GetDescription()
Returns
Type | Description |
---|---|
string | This event's description. |
GetDescription(CacheEventType)
Convert an event type into a human-readable string.
Declaration
public static string GetDescription(CacheEventType eventType)
Parameters
Type | Name | Description |
---|---|---|
CacheEventType | eventType | An event type, one of the CacheEventType enumerated values. |
Returns
Type | Description |
---|---|
string | A corresponding human-readable string, for example "inserted". |
ShouldDispatch(ICacheListener)
Return true if the provided ICacheListener should receive this event.
Declaration
public bool ShouldDispatch(ICacheListener listener)
Parameters
Type | Name | Description |
---|---|---|
ICacheListener | listener | The ICacheListener. |
Returns
Type | Description |
---|---|
bool |
ToString()
Return a string representation of this CacheEventArgs object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A String representation of this CacheEventArgs object. |