NCache 4.6 - Online Documentation

Disposing Cache

 
After you are done using cache, you can dispose it.
 
      To utilize the API, include the following namespace in your application: Alachisoft.NCache.Web.Management.
 
The code for disposing the cache is as follows:
 
Cache _cache = NCache.InitializeCache("myCache");
 
//Dispose the cache
_cache.Dispose();
 
Disposing the cache in ASP.NET Applications
 
If you are developing ASP.NET application, the best place to put Dispose() call is in your HttpApplication's Dispose() method. This method is called when the instance of your HttpApplication is destroyed.
 
public virtual void Dispose()
{
Cache_cache = NCache.InitializeCache("myCache");
 
// Dispose the cache
_cache.Dispose();
}
 
 
See Also