Event Notifications
Many applications today need to share data asynchronously with each other at runtime, and relational databases do not provide an efficient event notification mechanism. Hence, their performance and scalability is a major concern.
NCache features event driven fetching of data every time data in the cache is modified. This allows client applications to receive data without any explicit data fetch request to the cache server. Events work on the push mechanism: whenever some activity of interest takes place in cache, it publishes events to its subscribed clients. This allows runtime data sharing of single cache shared by separate applications or separate modules of same application.
Events enable NCache to notify the client application if any change of interest occurs. Events in NCache follow the publisher-subscriber model where cache is the publisher and client application is the subscriber.
Events have the following properties:
The publisher determines when an event is raised; the subscribers determine what action is taken in response to the event.
An event can have multiple subscribers. A subscriber can handle multiple events from multiple publishers.
Events are typically used to signal common cache operations like Add, Insert, Remove, Delete and Cache Cleared.
Events and Event Types
Add Notification
Add notification is triggered when a new item is added to the cache. All applications which have registered this event will receive a notification when data is added to the cache.Update Notification
Update notification is triggered when an existing item is updated in the cache. All applications which have registered this event will receive a notification when data is updated in the cache.Remove Notification
Remove notification is triggered when an item is removed from the cache. All applications which have registered this event will receive a notification when data is removed from the cache.Cache Clear Notification
Cache Clear notification is triggered when cache is cleared. All applications which have registered this event will receive a notification when the cache is cleared.
Event Levels
NCache provides the following level of events:
Cache Level Events
NCache can notify clients on addition, insertion, and removal of any item in the cache or if the cache is cleared, if the client has registered interest in receiving such events.Item Level Events
NCache can notify clients on a specific item update and remove if the client has registered interest in it.Continuous Query Events
NCache can monitor a dataset in the cache based on SQL-like criteria and then notify clients for addition, insertion, and removal of items from this data set to clients who have registered interest in it.Application Initiated Custom Events
Applications can fire custom events into NCache so other applications who have registered interest in them can be notified.
In This Section
Cache Level Data Event Notifications
Explains how to use notification mechanism for events occurring at cache level.
Item Level Data Event Notifications
Explains how to use notification mechanism for events occurring at item level.
Custom Event Notifications
Explains how to use custom events and notification mechanism provided by NCache.