General Cache Configuration Settings
NCache gives you full control of cache configurations so that you can create and configure a cache according to your requirements. Cache settings can be configured by using the NCache Management Center or PowerShell tools. These settings can also be specified in the client.ncconf file.
Important
In case you want to update any cache settings please refer to the Update Cache Config section to follow the set of steps.
Cache Size
Through this configuration option, you can specify an upper limit on the size of the cache in MB. The number of items in the cache is limited by the maximum size of the cache and the amount of free system memory (virtual or physical). If some eviction policy is specified, whenever the total data size in the cache reaches maximum size items are removed from the cache as per eviction policy.
Using the NCache Management Center
Launch the NCache Management Center by browsing to
http://localhost:8251
(Windows) or<server-ip>:8251
(Windows + Linux).In the left navigation bar, click on Clustered Caches or Local Caches, based on the cache server to start. Against the cache name, click on View Details.
This opens up the detailed configuration page for the cache.
In the Overview tab, click on the button.
Change the Max Cache Size which is in MBs.
- Click on to save the cache configuration.
Manually Editing NCache Configuration
You can specify the Cache Size through config.ncconf file located at %NCHOME%\config. %NCHOME%
is the NCache install directory. In config.ncconf of EACH server specify the <storage>
tag under the <cache-settings>
tag:
<cache-config>
<cache-settings ...>
...
<storage type="heap" cache-size="1024mb"/>
...
</cache-settings>
</cache-config>
InProc/OutProc for Local Cache
You can specify InProc or OutProc values for local cache.
Using the NCache Management Center
Launch the NCache Management Center by browsing to
http://localhost:8251
(Windows) or<server-ip>:8251
(Windows + Linux).In the left navigation bar, click on Local Caches.
Important
Make sure the cache you want to configure is stopped.
- Against the cache name, click on View Details.
This opens up the detailed configuration page for the cache. Go to the Main tab.
Select the Isolation Level for the cache.
- Click on Save Changes to apply these configurations to the cache.
Manually Editing NCache Configuration
For more detail please refer to the Isolation levels section.
In config.ncconf, you can specify the attribute value of InProc as true (for InProc) or false (for OutProc).
InProc:
<cache-config cache-name="demoCache">
<cache-settings inproc="True">
...
</cache-settings>
</cache-config>
OutProc:
<cache-config cache-name="demoCache">
<cache-settings inproc="False">
...
</cache-settings>
</cache-config>
Configure Serialization Format
Note
It is recommended that you use JSON serialization if you are using ASP.NET 5.0 and above. For more details click here.
By default, NCache uses the Binary Format. To enable JSON serialization on your cache, follow the steps below.
Note
JSON serialization is available in NCache Enterprise and Professional.
Note
- You cannot JSON serialize an InProc cache because by default the data format of an InProc cache is an object.
- It is recommended that you use JSON serialization if you are using ASP.NET 5.0 and above. For more details click here.
Using the NCache Management Center
Launch the NCache Management Center by browsing to
http://localhost:8251
(Windows) or<server-ip>:8251
(Windows + Linux).In the left navigation bar, click on Clustered Caches or Local Caches, based on the cache to configure.
Important
Make sure the cache is stopped before proceeding.
- Against the cache name, click on View Details.
This opens up the detailed configuration page for the cache. Go to the Advanced Settings tab and click on Cluster Settings in the left bar.
Change the Serialization to either Binary or JSON.
Click on Save Changes to apply this configuration to the cache.
Start the cache to resume operations.
Manually Editing NCache Configuration
You can also specify the cache serialization format through config.ncconf
.
<cache-config ...>
<cache-settings inproc="False" last-modified="" auto-start="False" data-format="Serialized" serialization="Json">
</cache-config>
See Also
Configure Caches
Configure Clients
Management Operations
Cache Cluster Settings