Method UnRegisterCacheNotification
UnRegisterCacheNotification(String, CacheDataNotificationCallback, EventType)
Unregisters event that may have been registered against a specific key
Declaration
public virtual void UnRegisterCacheNotification(string key, CacheDataNotificationCallback callback, EventType eventType)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The cache key used to reference the cache item |
CacheDataNotificationCallback | callback | The CacheDataNotificationCallback that was specified while registering the event. |
Alachisoft.NCache.Runtime.Events.EventType | eventType | Type of the event to unregister |
Examples
Let us consider you registered an event against a key
Cache cache = NCache.InitializeCache("myCache");
cache.RegisterCacheNotification(key, new CacheDataNotificationCallback(ItemCallback), EventType.ItemAdded, EventDataFilter.None);
Now, Unregister this event by providing the key, callback and eventtype
cache.UnRegisterCacheNotification(key, new CacheDataNotificationCallback(ItemCallback), EventType.ItemAdded);
UnRegisterCacheNotification(String[], CacheDataNotificationCallback, EventType)
Unregisters any event that may have been registered by the user against multiple cache keys
Declaration
public virtual void UnRegisterCacheNotification(string[] key, CacheDataNotificationCallback callback, EventType eventType)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | key | An array of cache keys used to reference the cache itemst |
CacheDataNotificationCallback | callback | The CacheDataNotificationCallback that was specified while registering the event. |
Alachisoft.NCache.Runtime.Events.EventType | eventType | Type of event to unregister |
Examples
Let us consider you registered an event against a bulk of keys
Cache cache = NCache.InitializeCache("myCache");
string[] keys=new string[size];
cache.RegisterCacheNotification(keys, new CacheDataNotificationCallback(ItemCallback), EventType.ItemAdded, EventDataFilter.None);
Now, Unregister this event by providing the key, callback and eventtype
cache.UnRegisterCacheNotification(keys, new CacheDataNotificationCallback(ItemCallback), EventType.ItemAdded);
UnRegisterCacheNotification(CacheEventDescriptor)
Unregisters a cache level event that may have been registered
Declaration
public virtual void UnRegisterCacheNotification(CacheEventDescriptor discriptor)
Parameters
Type | Name | Description |
---|---|---|
CacheEventDescriptor | discriptor | The descriptor returned when the general event was registered |
Examples
Let us consider you registered an event against a cache
Cache cache = NCache.InitializeCache("myCache");
CacheEventDescriptor eDescriptor=cache.RegisterCacheNotification(new CacheDataNotificationCallback(ItemCallback), EventType.ItemAdded, EventDataFilter.None);
Now, Unregister this event by using the CacheEventDescriptor returned by regitering the event
cache.UnRegisterCacheNotification(eDescriptor);