Create a Distributed Cache with Persistence
This section will demonstrate how you can create a distributed cache with persistence through the NCache Web Manager and PowerShell.
Note
A distributed cache with persistence supports only Partitioned topologies and Local (OutProc) caches.
Using NCache Web Manager
Launch NCache Web Manager by browsing to
<server-ip>:8251
.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 distributed cache with persistence, click on New.
- From the In-Memory Store Type dropdown menu, select Distributed Cache with Persistence and specify the name of your cache. Click Next.
Note
Distributed cache with persistence supports JSON serialization only.
- Select the caching topology and advanced options like Operation timeout and Statistic replication interval. Click Next.
Note
Distributed cache with persistence supports the Partitioned and Partition-Replica Topologies only.
- Specify the Cache Partition Size and add your cluster nodes by providing the Server Node IP or Host Name and clicking on Add Node button. To add more nodes, click Add Node. Once all the required nodes are added, click Next.
- Next, you need to provide the persistence store settings for this cache on Persistence Settings page. Choose New Store against the Select Store label. Specify the name of your store against Store Name label. For connection information, provide the UNC Path. Once done, click on Test Connection. If the connection to the persistence store is tested successfully, you will be prompted with a success notification. Click Next.
Important
A shared path accessible to all server nodes should be already configured for NCache Persistence. To set up a shared path on Linux for NCache Persistence, see Configure File Share on Linux.
Warning
Unless the connection to the persistence store has been tested successfully, you can not proceed further with the cache creation process.
- 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 (in microseconds) for the duration after which the commands will be transmitted over the network. Click Next.
- If you want to enable encryption and compression, check the Enable Encryption and Enable Compression checkboxes. If enabled, set the Providers and Key for encryption and Threshold Size for compression. Click Next.
Note
If you want to use an existing store with encryption while creating a new cache, then encryption must be enabled on the new cache and vice versa. If the existing store was encrypted, the encryption credentials (provider and key) need to be the same as the ones used for the original store. If they are different, you will not be allowed to create the cache.
In Advanced Options page, you can configure the following settings:
Eviction can't be enabled for this cache.
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.
Note
Eviction is not supported for a distributed cache with persistence.
Warning
The cache will not start on the node on which the persistence store is inaccessible.
- Click Finish to complete the process. Your created cache will appear in Clustered Caches page with the server nodes and their status and a success notification will be displayed in the notification panel.
Warning
If the store with the specified name already exists, you will be prompted with an error message.
Using PowerShell
You can also use the PowerShell to manage persistent caches by using the NCache supported PowerShell cmdlets.
Create Cache
The New-Cache PowerShell cmdlet is responsible for creating new caches.
Important
A shared path accessible to all server nodes should be already configured for NCache Persistence. You can see Configure File Share on Linux to set up and configure file share for NCache Persistence.
The following command creates a distributed cache with persistence named demoPersistenceCache on the server nodes 20.200.20.174 and 20.200.20.175. New NCache Persistence store named demoPersistenceCache_db is created on the path /mnt/nfsshare. The topology is PartitionedOfReplica and cache size is 1024MB.
Warning
The cache creation process will fail if the connection to the persistence store is unsuccessful.
New-Cache -Name demoPersistenceCache -Server "20.200.20.174,20.200.20.175" -InMemoryStoreType DistributedCacheWithPersistence -NewPersistenceStore -PersistenceStoreConnectionString "/mnt/nfsshare" -Topology PartitionedOfReplica -Size 1024
Start Cache
Start-Cache cmdlet enables the user to start the registered cache. If the server nodes are specified, the Cache process is started on the specified nodes.
Warning
The cache will not start on the node on which the persistence store is inaccessible.
Perform this step on all server nodes to start the previously created demoPersistenceCache.
Start-Cache -Name demoPersistenceCache
See Also
Create New Distributed Cache with Persistence
Add Local Remote Clients
NCache Programmer's Guide
NCache PowerShell Guide