Creating Cache
NCache Professional edition allows you to create the following caches:
- Partitioned Cache
- Replicated Cache
- Local Cache (meaning a standalone cache)
For other caching topologies, please download and use NCache Enterprise. See more details on edition comparison between NCache Professional and Enterprise.
We'll create a Partitioned Cache here.
Pre-requisite
Have a look at supported browsers and other configurations for Web Manager here.
For .NET, make sure NCache Service (NCacheSvc) is started. If it is not started, type the following command in PowerShell (run as admin):
Start-Service -Name NCacheSvc
- For .NET Core, run NCache Service (NCacheSvc) as Administrator. Please refer to this section for detail.
Using NCache Web Manager
Launch NCache Web Manager by browsing to
http://localhost:8251
(Windows) or<server-ip>:8251
(Windows + Linux).In the left navigation bar, click on Clustered Caches. This opens up the Clustered Caches page at
<server-ip>:8251/ClusteredCaches/
.To create a new clustered cache, click on New.
- Specify the cache name and serialization (Binary or JSON). Click Next. If a cache by that name exists, you are prompted accordingly.
Note
It is recommended that you use JSON serialization if you are using ASP.NET 5.0 and above. For more details click here.
- Select the caching topology and any advanced options like Operation Timeout and Statistic Replication Level. Click Next.
- Specify Maximum Size of the cache, if required. You can also add cache nodes to the cluster by specifying the node IP address and clicking on +. To add more nodes, click +. Click Next once all the required nodes are added.
Warning
If a node is already registered on that cache, notification is prompted.
- Change the Cluster Port and Port Range if required. Click Next.
In Advanced Options page, you can configure the following settings:
You can change the Eviction percentage; items will be evicted from the cache using this percentage value if eviction is enabled.
You can change the Clean interval value. Default is 15 seconds.
This cache can be started automatically upon the completion of this process if you have checked the Start this cache on Finish checkbox on this dialog box.
You can make the cache start itself automatically after service restart by checking the checkbox Auto start this cache on service startup.
- Click Finish. Created cache will appear in Clustered Caches page with the server nodes and their status and a success notification will be received in the notification panel.
Using PowerShell
Create New Cache
New-Cache cmdlet enables the user to create a new cache on one or more server nodes.
In PowerShell, execute the following command to create a new partitioned cache named demoCache on server 20.200.20.200, with default configurations.
Warning
Cache with the specified name should not exist on the server; otherwise you get an error message that this cache already exists on this server.
New-Cache -Name demoCache -Server 20.200.20.200 -Size 1024 –Topology Partitioned
You can create a Replicated cache by specifying -Topology Replicated
.
Start Cache
To start the cache, please type the following command in PowerShell:
Start-Cache –Name demoCache -Serer 20.200.20.29
Successful cache creation will be prompted on the screen.
Verify Successful Cache Creation
To verify that you’ve created the cache successfully, please type the following command in PowerShell:
Get-Caches -Detail
This command gives a detailed status of all caches registered on the cache server. You should see that demoCache has a Cluster-size of 1 with IP address of the cache server listed with it. In order to get the detail of the caches on a specific server, run the above command along with the parameter -Server
. The output also displays the Item Count, which at this stage should be 0.
See Also
Add Local/Remote Clients
Monitor Caches in PerfMon
Use NCache for Data Caching
NCache Programmer's Guide
NCache PowerShell Guide