Creating a Cache
NCache allows you to create the following caches:
PartitionedOfReplica
CachePartitioned
CacheReplicated
CacheMirror
CacheLocal
Cache (meaning a standalone cache)
See more details on edition comparison between NCache Professional and Enterprise.
We'll create a Partitioned-Replica Cache here.
Pre-requisites
Have a look at supported browsers and other configurations for Web Manager here.
Make sure NCache Service is started. If it is not started, type the following command in a terminal:
> sudo systemctl start ncached
Using NCache Web Manager
Launch NCache Web Manager by browsing to
<server-ip>:8251
.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 have to 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:
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 partitioned-replica 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 a 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 nodes.
Perform this step on all server nodes. You can also specify the particular server where you need to start the cache.
Start-Cache -Name demoClusteredCache -Server 20.200.20.29
See Also
Add Local/Remote Clients
Monitor Caches using NCache Monitor
Use NCache from .NET Application
Use NCache for ASP.NET Sessions
NCache Programmer's Guide
NCache PowerShell Guide