NCache 4.6 - Online Documentation

Clear Cache with Registered Callback Method

 
AsynccacheClearedCallback if registered with NCache is triggered whenever a ClearAsync operation is performed successfully. In this example, the user needs to register the callback when calling the method.
 
      To utilize the API, include the following namespace in your application: Alachisoft.NCache.Web.Caching.
 
        try
        {
            cache.ClearAsync(new AsyncCacheClearedCallback(OnCacheCleared));
        }
        catch (Exception ex)
        {
            //handle exception
        }
 
//Create a callback
        public static void OnCacheCleared(object result)
        {
            if (result.ToString().Equals("Success"))
            {   
                //do something
            }
            if (result.ToString().Equals("Failure"))
            {   
                //do something
            }
            if (result is Exception)
            {   
                //do something
            }
        }
  
 
See Also