Create a Cache
NCache Enterprise edition allows you to create the following caches:
- Partitioned-Replica Cache
- Replicated Cache
- Partitioned Cache
- Mirror Cache
- Local Cache (standalone cache)
See more details on edition comparison between NCache Enterprise and Professional. We’ll create a Partitioned-Replica Cache here in both ways - NCache Web Manager and PowerShell tool.
Pre-requisites
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.
Select the caching topology and any advanced options like Operation Timeout and Statistic Replication Level. Click Next.
If you selected the Partition-Replica Cache topology, you have to select a Replication Strategy, either Asynchronous or Synchronous. 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. Enable pipelining for the cache if required by checking the Enable Pipelining checkbox. Set the batch interval for the duration after which the commands will be transmitted over the network in microseconds. Click Next.
In Advanced Options page, you can configure the following settings:
Eviction is enabled by default. You can configure the Eviction Policy accordingly. If you want to disable eviction, uncheck the check box Enable Eviction.
You can also 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 to start 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 Cache
New-Cache cmdlet enables the user to create a new cache on one or more server nodes.
This Command creates demoClusteredCache of PartitionedOfReplica topology of size 1024MB on node 20.200.20.38.
New-Cache demoClusteredCache -Server 20.200.20.38 -Size 1024 -Topology PartitionedOfReplica
Add Node to Cache
Add-Node cmdlet enables the users to add a new server node to the existing clustered cache on specified server. It also enables users to have multiple server nodes in a clustered cache.
This command adds a new node 20.200.20.29 to the cache named demoClusteredCache existing on server node 20.200.20.38 which already exists.
Add-Node -CacheName demoClusteredCache -ExistingServer 20.200.20.38 -NewServer 20.200.20.29
Start Cache
Once the cache is created, you need to start the clustered cache on all the server nodes so that operations can be performed on it. Start-Cache cmdlet enables the user to start the registered cache and Cache process on the specified nodes.
Perform this step on all server nodes.
Start-Cache -Name demoClusteredCache -Server 20.200.20.29
See Also
Add Local/Remote Clients
Monitor Caches in PerfMon
Use NCache from .NET Application
Use NCache for ASP.NET Sessions
NCache Programmer's Guide
NCache PowerShell Guide