Alachisoft NCache 4.1 - Online Documentation

Cache Stopped Event

NOTE: This feature is not available in NCache Express and Professional edition.
NCache provides the CacheStoppedCallback delegate. It defines the signature to use when you write event handlers to respond when the running cache stops.
Notify application when cache stops
  1. Add the following namespaces in your application for using events:
    using Alachisoft.NCache.Web.Caching;
    using Alachisoft.NCache.Runtime;
  2. Create an event handler procedure that will be called by CacheStoppedCallback when cache stops. For example, the following code prints cache information that is being stopped.
    public void OnCacheStopped(string cacheid)
    Consol.Writeline(cacheid + "is stopped now");
  3. Create an instance of the CacheStoppedCallback delegate that calls the event handler. The following code calls the method created in step two.
    Cache _cache = NCache.InitializeCache("mycache");
    _cache.CacheStopped = new CacheStoppedCallback(this.OnCacheStopped);
    When a cache stops running, the OnCacheStopped method is called.
See Also
Copyright © 2005-2012 Alachisoft. All rights reserved.