NCache provides users with the facility to override the default cache initialization settings that are already set in client.ncconf file. CacheInitParams is a class that holds these customized parameters that can be passed to the NCache.InitializeCache API in order to initialize a specific cache. It holds the set of parameters that control the initialization behavior of the cache. Instead of the application picking up certain settings from the config files, you can dynamically give these settings through your code.
The full definition of the object is Alachisoft.NCache.Runtime.Caching.CacheInitParams. Here is a step by step process to use CacheInitParams to add server information of a cache cluster.Step 1
Add references to the file Alachisoft.NCache.Runtime.Caching which is located at
Assembly: Alachisoft.NCache.Web (in Alachisoft.NCache.Web.dll)
Initialize the object as follows:
CacheInitParams param = new CacheInitParams();
Add Server information by creating CacheServerInfo object and add server information to it as follows:
CacheServerInfo info = new CacheServerInfo; info = new CacheServerInfo("220.127.116.11",9800); info = new CacheServerInfo("18.104.22.168",9800);
Then add the CacheServerInfo object to the CacheInitParam
param.ServerList = info;
Add the CacheInitParams to the InitializeCache API call
Cache _nCache = NCache.InitializeCache("mycache", param);
Find the complete list of CachiInitParams Members at Alachisoft website.