NCache 4.4 - Online Documentation

Dispose Cache

 
After you are done using cache, you can dispose it. Include the following namespace in your project:
 
using Alachisoft.NCache.Web.Caching;
 
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're 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