How to use Backup and Restore on Cached Data

NCache enables the user to create a backup of your cache data. Export-CacheData cmdlet creates a backup of all the items currently present in the cache to a network or local path provided by the user. Similarly, NCache provides an Import-CacheData cmdlet that enables the user to import the data placed at a specific path to your cache.

NOTE: You may be unable to run NCache PowerShell cmdlets if the environment variable PSModulePath has not been refreshed after the installation. Import the NCache PowerShell module (ncacheps.dll) found in the following location:
%NCHOME%\bin\tools\ncacheps

Backup Cache Data to a Specified Path

You can export the cache contents to any path specified by you along with the path of the dependent assemblies. The PowerShell cmdlet used for this purpose is:

Export-CacheData [-Name] [-NoLogo] [-Password] [-Path] [-Port] [-UserId]

The mandatory parameters of the command are explained below:

  • Name: Specifies the name of the cache which is to be backed up or restored.
  • Path: Specifies the path where the backup data is currently present.
  • AssemblyPath: Specifies the path where dependent assemblies reside.

Example: The following command backs up all the items of the cache to the specified path:

Export-CacheData -Name demoCache -AssemblyPath C:\assembly-folder -Path C:\recovery-path

Restore Data to Cache from a Specified Path

You can import data to the cache that resides on a specific path. The PowerShell cmdlet used for this purpose is:

Import-CacheData [-Name] [-AssemblyPath] [-BulkSize] [-ErrorThreshhold] [-Expiry] [-NoLogo] [-Password] [-Path] [-UserId]

The mandatory parameters of the command are explained below:

  • Name: Specifies the name of the cache which is to be backed up or restored.
  • Path: Specifies the path where the backup data is currently present.
  • AssemblyPath: Specifies the path where dependent assemblies reside.

Example: This command imports the data from the backup source placed on the specified path to the cache including the dependent assembly files.

Import-CacheData -Name demoCache -AssemblyPath C:\assembly-folder -Path C:\recovery-path

For more detailed information please refer to the PowerShell Ref on our website.

What to Do Next?

Signup for monthly email newsletter to get latest updates.

© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.