coherence.event
MapEvent
- class coherence.event.MapEvent(source: NamedMap[K, V], response: MapEventResponse, serializer: Serializer)
Bases:
Generic
[K
,V
]An event which indicates that the content of a map has changed:
an entry has been added
an entry has been removed
an entry has been changed
- property description: str
Returns the event’s description. :return: the event’s description
- property key: K
Return the key for the entry generating the event. :return: the key for the entry generating the event
- property name: str
The name of the cache from which the event originated. :return: the cache name from which the event originated
- property new: V | None
Return the new value for the entry generating the event. :return: the new value, if any, for the entry generating the event
- property old: V | None
Return the old value for the entry generating the event. :return:the old value, if any, for the entry generating the event
- property source: NamedMap[K, V]
The source of the event. :return: the event source
- property type: MapEventType
The MapEventType. This may be one of: * MapEventType.ENTRY_INSERTED * MapEventType.ENTRY_UPDATED * MapEventType.ENTRY_DELETED :return: the event type
MapLifecycleEvent
- class coherence.event.MapLifecycleEvent(value)
Bases:
Enum
Enum of possible events that may be raised at different points of the cache lifecycle.
- DESTROYED = 'map_destroyed'
Raised when a storage for a given cache is destroyed (usually as a result of a call to NamedMap.destroy()).
- RELEASED = 'map_released'
Raised when the local resources for a cache has been released as a result of a call to NamedMap.release(). Entries within the cache remain untouched
- TRUNCATED = 'map_truncated'
Raised when a storage for a given cache is truncated as a result of a call to NamedMap.truncate().
MapEventType
- class coherence.event.MapEventType(value)
Bases:
Enum
Enum of possible events that could raise a MapEvent.
- ENTRY_DELETED = 'delete'
This event indicates that an entry has been removed from the cache.
- ENTRY_INSERTED = 'insert'
This event indicates that an entry has been added to the cache.
- ENTRY_UPDATED = 'update'
This event indicates that an entry has been updated in the cache.
MapListener
- class coherence.event.MapListener
Bases:
Generic
[K
,V
]A listener interface for receiving MapEvents.
- on_any(callback: Callable[[MapEvent[K, V]], None]) MapListener[K, V]
Defines the callback that should be invoked when any entry event has occurred.
- Parameters:
callback – the callback that will be invoked when a deletion event has occurred
- on_deleted(callback: Callable[[MapEvent[K, V]], None]) MapListener[K, V]
Defines the callback that should be invoked when a deletion event has occurred.
- Parameters:
callback – the callback that will be invoked when a deletion event has occurred
- on_inserted(callback: Callable[[MapEvent[K, V]], None]) MapListener[K, V]
Defines the callback that should be invoked when an insertion event has occurred.
- Parameters:
callback – the callback that will be invoked when an insertion event has occurred
- on_updated(callback: Callable[[MapEvent[K, V]], None]) MapListener[K, V]
Defines the callback that should be invoked when an update event has occurred.
- Parameters:
callback – the callback that will be invoked when an update event has occurred