NCache 4.6 - Online Documentation

Initialize Cache

After you have configured the cache, embed NCache API calls in your application to use it. The first thing you need to do is to initialize the cache.
      To utilize the API, include the following namespace in your application: Alachisoft.NCache.Web.Caching.
The code for initializing the cache is as follows:
// Initialize the cache.
Cache _cache = NCache.InitializeCache("myCache");
  Initializing Cache in ASP.NET Applications
If you are developing an  ASP.NET application, the best place to put InitializeCache call is in your Application_Start() functions in Global.asax.cs file.
Additionally, instead of hard-coding, we recommend keeping the cache name in Web.config and then accessing it from your code. This way, if you will be required to change your cache name at any stage, you will not have to recompile the code.
//Pick up the cache-name from Web.Config
public override void Init()
string cacheName = ConfigurationSettings.AppSettings["CacheName"];
Cache _cache = NCache.InitializeCache(cacheName);
In your Web.config, you can specify cache name as follows:
<add key = "CacheName" value = "myCache"/>
  See Also