Create a Persistent Cache
This section will demonstrate how you can create a persistent cache through the NCache Management Center and the Command Line Interface.
Note
A distributed cache with persistence supports only partitioned topologies and local (OutProc) caches.
Create Persistent Cache Using Management Center
Launch the NCache Management Center by browsing to http://localhost:8251 or
<server-ip>:8251
on Windows and 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 Persistent Cache, click on New.
- From the In-Memory Store Type dropdown menu, select the Persistent Cache option, i.e., Distributed Cache with Persistence and specify the name of your cache. Click Next.
Note
A 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
A 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 the Add Node button. To add more nodes, click Add Node. Once all the required nodes are added, click Next.
Warning
If a cache with the specified name already exists, you are prompted with an error message.
- Next, you need to provide the persistence store settings for this cache on the Persistence Settings page. Choose New Store against the Select Store label. Specify the name of your store against the Store Name label. For connection information, provide the UNC Path, User Name, and Password. Once done, click on Test Connection. If the connection to your persistence store has been successfully tested, you will receive a success notification. Click Next.
Important
NCache Persistence requires a shared path that is accessible from all nodes. Make sure that all nodes have read and write access to the shared path.
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 for the duration after which the commands will be transmitted over the network in microseconds. 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.
Warning
The cache will not start on a node on which the persistence store is inaccessible.
- Click Finish to complete the process. Your created cache will appear on the Clustered Caches page with the server nodes and their status and a success notification will be displayed in the notification panel.
Warning
If a database already exists with the specified Database Name, you will be prompted with an error message "Database already exists".
Using Command Line Interface
You can also use PowerShell or Command Line Tools to manage persistence caches by using the NCache supported Command Line Interface.
Create Cache
The New-Cache PowerShell cmdlet is responsible for creating new caches.
Important
NCache Persistence requires a shared path that is accessible from all nodes. Make sure that all nodes have read and write access to the shared path.
The following command creates a distributed cache with persistence named demoPersistenceCache on the server nodes 20.200.20.39 and 20.200.20.40. A new NCache Persistence store named demoPersistenceCache_db is created on the path \\fileserver\stores using the provided connection string. The topology is Partition-Replica and the cache size is 1024MB.
Note
For Windows, User Name and Password are required if authentication is enabled on the file share. You can also provide the domain name along with the user name as domain_name\user_name.
New-Cache -Name demoPersistenceCache -Server "20.200.20.39,20.200.20.40" -InMemoryStoreType DistributedCacheWithPersistence -NewPersistenceStore -PersistenceStoreConnectionString "\\fileserver\stores;domain_name\user_name;password" -Topology Partition-Replica -Size 1024
Warning
The cache creation process will fail if the connection to the persistence store is unsuccessful.
Start Cache
The 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 Command Line Interface