Try Playground
Show / Hide Table of Contents

Method UnRegisterCacheNotification

UnRegisterCacheNotification(CacheEventDescriptor)

Unregisters a cache-level event that may have been registered.

Declaration
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.

ICache cache = CacheManager.GetCache("demoCache");
CacheEventDescriptor descriptor = cache.MessagingService.RegisterCacheNotification(new CacheDataNotificationCallback(ItemCallback), EventType.ItemAdded, EventDataFilter.None);

Now, Unregister this event by using the CacheEventDescriptor returned by regitering the event.

cache.MessagingService.UnRegisterCacheNotification(descriptor);

UnRegisterCacheNotification(String, CacheDataNotificationCallback, EventType)

Unregisters the Alachisoft.NCache.Client.CacheItemUpdatedCallback already registered for the specified key.

Declaration
void UnRegisterCacheNotification(string key, CacheDataNotificationCallback callback, EventType EventType)
Parameters
Type Name Description
System.String key

Unique key to identify the cache item.

CacheDataNotificationCallback callback

The CacheDataNotificationCallback that is invoked when specified EventType is triggered in cache.

EventType EventType

Tells whether the event is to be raised on Item Added, Updated or Removed.

Examples

The following example registers and unregisters update and remove notification against a key First, create an ItemCallback.

ItemCallback(string key, CacheEventArg cacheEventArgs)
{
   ...
}

Then, register the Key Notification.

ICache cache = CacheManager.GetCache("demoCache");
cache.MessagingService.RegisterCacheNotification(key, new CacheDataNotificationCallback(ItemCallback), EventType.ItemUpdated, EventDataFilter.DataWithMetadata);

Now, Unregister this event.

cache.MessagingService.UnRegisterCacheNotification(key, new CacheDataNotificationCallback(ItemCallback), EventType.ItemUpdated);

UnRegisterCacheNotification(IEnumerable<String>, CacheDataNotificationCallback, EventType)

Unregisters cache notification against specified keys in cache.

Declaration
void UnRegisterCacheNotification(IEnumerable<string> keys, CacheDataNotificationCallback callback, EventType EventType)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.String> keys

IEnumerable list of keys to identify the cache item.

CacheDataNotificationCallback callback

The CacheDataNotificationCallback that is invoked when specified EventType is triggered against specified keys in cache.

EventType EventType

Tells whether the event is to be raised on Item Added, Updated or Removed.

Examples

The following example demonstrates how to unregister Item added, updated or removed notification against multiple keys in cache. First, create an ItemCallback.

ItemCallback(string key, CacheEventArg cacheEventArgs)
{
   ...
}

Then, register the Key Notification.

ICache cache = CacheManager.GetCache("demoCache");

List<string> keys = new List<string>()
{
    "Product0",
    "Product1",
    "Product2"
};

cache.MessagingService.RegisterCacheNotification(keys, new CacheDataNotificationCallback(ItemAdded), EventType.ItemAdded, EventDataFilter.DataWithMetadata);

Now, Unregister this event.

cache.MessagingService.UnRegisterCacheNotification(keys, new CacheDataNotificationCallback(ItemAdded), EventType.ItemAdded);

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Professional
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top