Update Cache Configuration
NCache lets you change the cache configuration, but these changes will not be effective unless you restart the NCache Service.
Note
Caches other than the one that needs modifications don't need to be stopped for you to change cache configurations. Even when you restart the service, no other cache processes stop.
Step 1: Stop Cache on All Nodes
You need to stop the cache, in case it's running, on the local server (in case of local cache) and on all servers in case you use a clustered cache. Using PowerShell, you can stop the cache by using the following cmdlet.
Stop-Cache -CacheName demoCache
Step 2: Modify config.ncconf on All Nodes
The cache configuration must remain the same. For example, if you need to change the size of the cache from 1GB to 2GB, then you need to reflect this change for all cache server nodes. If this cache configuration is not identical for all cache server nodes, you might notice your cache behaving unpredictably.
Change the configurations in the config.ncconf file as per your requirements.
For instance, if you need to modify the size of a cache, you will have to update the config.ncconf of the local server machine in case of a local cache and all servers in case of a clustered cache.
You can specify the <cache-size>
by updating the <storage>
tag under the <cache-settings>
tag.
<cache-config>
<cache-settings ...>
...
<storage type="heap" cache-size="1024mb"/>
...
</cache-settings>
</cache-config>
Please refer to the section on Configure Cache Settings for more details on updating cache settings.
Step 3: Restart NCache Service on All Nodes
You will have to restart the NCache Service for the changes made in the configuration to take effect. To be able to restart the service, you need to have administrative privileges. Otherwise, you might get an error stating, "Cannot open ncachesvc service on computer."
To restart the NCache Service, run the following command:
Restart-Service -Name NCacheSvc
Step 4: Start Cache on All Nodes
Start the cache on all servers once the cache configurations are updated. You can do this through a PowerShell tool Start-Cache.
Start-Cache -Name <cache-name>
See Also
Create a Cache
Remove Cache
Add Server Node
Remove Server Node