Registers ItemAdded, ItemUpdate or ItemRemoved events with cache

Namespace: Alachisoft.NCache.Web.Caching
Assembly: Alachisoft.NCache.Web (in Alachisoft.NCache.Web.dll) Version: (


public virtual CacheEventDescriptor RegisterCacheNotification(
	CacheDataNotificationCallback cacheDataNotificationCallback,
	EventType eventType,
	EventDataFilter datafilter
Visual Basic
Public Overridable Function RegisterCacheNotification ( 
	cacheDataNotificationCallback As CacheDataNotificationCallback,
	eventType As EventType,
	datafilter As EventDataFilter
) As CacheEventDescriptor
Visual C++
virtual CacheEventDescriptor^ RegisterCacheNotification(
	CacheDataNotificationCallback^ cacheDataNotificationCallback, 
	EventType eventType, 
	EventDataFilter datafilter


Type: Alachisoft.NCache.Web.Caching..::..CacheDataNotificationCallback
the CacheDataNotificationCallback that is invoked when an item is added, updated or removed from the cache.
Type: Alachisoft.NCache.Runtime.Events..::..EventType
Tells whether the event is to be raised on Item Added, Updated or Removed
Type: Alachisoft.NCache.Runtime.Events..::..EventDataFilter
Tells whether to receive metadata, data with metadata or none when a notification is triggered

Return Value

Type: CacheEventDescriptor


Client application can show interest in receiving events if an item is added, update or removed from the cache. As soon as the item is added, updated or removed from the cache, the client application is notified and actions can be taken accordingly.


First create an ItemCallback
 Copy imageCopy
ItemCallback(string key, CacheEventArg e)
Then register the Cache Notification
 Copy imageCopy
Cache cache = NCache.InitializeCache("myCache");
CacheEventDescriptor descriptor=cache.RegisterCacheNotification(new CacheDataNotificationCallback(ItemCallback), EventType.ItemAdded, EventDataFilter.None);

See Also