C++ Client API Reference for Oracle Coherence
14c (14.1.2.0.0)

F79659-03

CacheEvent Class Reference

#include <coherence/net/cache/CacheEvent.hpp>

Inherits MapEvent.

Inherited by ConverterCollections::ConverterCacheEvent, and MapListenerSupport::FilterEvent.

List of all members.


Detailed Description

An extension of the MapEvent which allows to differentiate between client driven (natural) events and cache internal (synthetic) events.

Consider a client code calling a remove() method for a cache. Quite naturally it causes a corresponding entry_deleted event. However, the same event could be as well caused by the client code calling put() forcing an entry eviction. Alternatively, the put() method called by client code naturally causes either entry_inserted or entry_updated event. However, the same event could be as well caused by a client call to a get() method that in turn forces an entry insertion by a cache loader.

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.

Author:
js 2008.06.06

Public Types

enum  TransformationState { non_transformable, transformable, transformed }
 Transformation state constants. More...
typedef spec::Handle Handle
 CacheEvent Handle definition.
typedef spec::View View
 CacheEvent View definition.
typedef spec::Holder Holder
 CacheEvent Holder definition.

Public Member Functions

virtual bool isSynthetic () const
 Return true iff this event is caused by internal cache processing such as eviction or loading.
virtual
TransformationState 
getTransformState () const
 Return transformation state of this event.
virtual bool isPriming () const
 Return true iff this event is caused by a priming listener registration.
virtual bool isExpired () const
 Return true iff this event is caused by an entry eviction due to time limit reached.
virtual String::View getDescription () const
 Return a human-readable description of the state of this class in the form of a delimited list of name-value pairs.

The default implementation returns an empty string


Protected Member Functions

 CacheEvent (ObservableMap::Handle hMap, int32_t nId, Object::View voKey, Object::View voValueOld, Object::View voValueNew, bool fSynthetic)
 Create a new CacheEvent.
 CacheEvent (ObservableMap::Handle hMap, int32_t nId, Object::View voKey, Object::View voValueOld, Object::View voValueNew, bool fSynthetic, bool fPriming)
 Create a new CacheEvent.
 CacheEvent (ObservableMap::Handle hMap, int32_t nId, Object::View voKey, Object::View voValueOld, Object::View voValueNew, bool fSynthetic, TransformationState nTransformState)
 Create a new CacheEvent.
 CacheEvent (ObservableMap::Handle hMap, int32_t nId, Object::View voKey, Object::View voValueOld, Object::View voValueNew, bool fSynthetic, TransformationState nTransformState, bool fPriming)
 Create a new CacheEvent.
 CacheEvent (ObservableMap::Handle hMap, int32_t nId, Object::View voKey, Object::View voValueOld, Object::View voValueNew, bool fSynthetic, TransformationState nTransformState, bool fPriming, bool fExpired)
 Constructs a new CacheEvent.
virtual bool shouldDispatch (TypedHandle< const MapListener > vListener) const
 Return true if the provided MapListener should receive this event.

Parameters:
vListener the MapListener to dispatch this event to
Returns:
true if the provided MapListener should receive the event
Since:
12.2.1.3.2


Protected Attributes

bool m_fSynthetic
 Event cause flag.
TransformationState m_nTransformState
 The TransformationState for this event.
bool m_fPriming
 Flag indicating whether or not the event is a priming event (NearCache).
bool m_fExpired
 Flag indicating whether the deletion event is a result of time expiration.

Member Enumeration Documentation

enum TransformationState

Transformation state constants.

TransformationState describes how a CacheEvent has been or should be transformed.

Enumerator:
non_transformable  Value used to indicate that an event is non-transformable and should not be passed to any transformer-based listeners.
transformable  Value used to indicate that an event is transformable and could be passed to transformer-based listeners.
transformed  Value used to indicate that an event has been transformed, and should only be passed to transformer-based listeners.


Constructor & Destructor Documentation

CacheEvent ( ObservableMap::Handle  hMap,
int32_t  nId,
Object::View  voKey,
Object::View  voValueOld,
Object::View  voValueNew,
bool  fSynthetic 
) [protected]

Create a new CacheEvent.

Parameters:
hMap the map on which the Event initially
nId occurred the events id (entry_inserted | entry_updated | entry_deleted)
voKey the key into the map
voValueOld the old value (for update and delete events)
voValueNew the new value (for insert and update events)
fSynthetic true iff the event is caused by internal cache processing such as eviction or loading

CacheEvent ( ObservableMap::Handle  hMap,
int32_t  nId,
Object::View  voKey,
Object::View  voValueOld,
Object::View  voValueNew,
bool  fSynthetic,
bool  fPriming 
) [protected]

Create a new CacheEvent.

Parameters:
hMap the map on which the Event initially
nId occurred the events id (entry_inserted | entry_updated | entry_deleted)
voKey the key into the map
voValueOld the old value (for update and delete events)
voValueNew the new value (for insert and update events)
fSynthetic true iff the event is caused by internal cache processing such as eviction or loading
fPriming a flag indicating whether or not the event is a priming event

CacheEvent ( ObservableMap::Handle  hMap,
int32_t  nId,
Object::View  voKey,
Object::View  voValueOld,
Object::View  voValueNew,
bool  fSynthetic,
TransformationState  nTransformState 
) [protected]

Create a new CacheEvent.

Parameters:
hMap the map on which the Event initially
nId occurred the events id (entry_inserted | entry_updated | entry_deleted)
voKey the key into the map
voValueOld the old value (for update and delete events)
voValueNew the new value (for insert and update events)
fSynthetic true iff the event is caused by internal cache processing such as eviction or loading
nTransformState the TransformationState describing how this event has been or should be transformed
Since:
Coherence 3.7.1.9

CacheEvent ( ObservableMap::Handle  hMap,
int32_t  nId,
Object::View  voKey,
Object::View  voValueOld,
Object::View  voValueNew,
bool  fSynthetic,
TransformationState  nTransformState,
bool  fPriming 
) [protected]

Create a new CacheEvent.

Parameters:
hMap the map on which the Event initially
nId occurred the events id (entry_inserted | entry_updated | entry_deleted)
voKey the key into the map
voValueOld the old value (for update and delete events)
voValueNew the new value (for insert and update events)
fSynthetic true iff the event is caused by internal cache processing such as eviction or loading
nTransformState the TransformationState describing how this event has been or should be transformed
fPriming a flag indicating whether or not the event is a priming event
Since:
12.2.1.3.2

CacheEvent ( ObservableMap::Handle  hMap,
int32_t  nId,
Object::View  voKey,
Object::View  voValueOld,
Object::View  voValueNew,
bool  fSynthetic,
TransformationState  nTransformState,
bool  fPriming,
bool  fExpired 
) [protected]

Constructs a new CacheEvent.

Parameters:
map the ObservableMap object that fired the event
nId this event's id, one of (entry_inserted | entry_updated | entry_deleted)
oKey the key into the map
oValueOld the old value (for update and delete events)
oValueNew the new value (for insert and update events)
fSynthetic true iff the event is caused by the cache internal processing such as eviction or loading
transformState the TransformationState describing how this event has been or should be transformed
fPriming a flag indicating whether or not the event is a priming event
fExpired true iff the event results from an eviction due to time
Since:
22.06


Member Function Documentation

virtual bool isSynthetic (  )  const [virtual]

Return true iff this event is caused by internal cache processing such as eviction or loading.

Returns:
true iff this event is caused by internal cache processing

virtual TransformationState getTransformState (  )  const [virtual]

Return transformation state of this event.

Non-transformable events will not be delivered to MapEventTransformer MapEventTransformer listeners.

Returns:
the TransformationState for this event

virtual bool isPriming (  )  const [virtual]

Return true iff this event is caused by a priming listener registration.

Returns:
true iff this event is caused by a priming listener registration
Since:
12.2.1.3.2

virtual bool isExpired (  )  const [virtual]

Return true iff this event is caused by an entry eviction due to time limit reached.

In this case the event will also be synthetic.

Returns:
true iff this event results from a timed eviction
Since:
22.06


Member Data Documentation

bool m_fPriming [protected]

Flag indicating whether or not the event is a priming event (NearCache).

Since:
12.2.1.3.2

bool m_fExpired [protected]

Flag indicating whether the deletion event is a result of time expiration.

Since:
22.06


The documentation for this class was generated from the following file:
Copyright © 2000, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.