Export-CacheData
The Export-CacheData PowerShell cmdlet creates a backup of all items currently present in the cache, and saves them to a specified local or network path. This cmdlet is useful for scenarios such as disaster recovery, data migration, and long-term data storage. It supports multi-server environments and allows you to control the file size of the backup (default is 5MB per file). The cmdlet is designed to handle errors gracefully, ensuring that the backup process is not interrupted. In order to restore the backed up data, use the Import Cache Data PowerShell cmdlet.
Export-CacheData -Name [-ErrorThreshold] [-FileSize] [-Server] -Path [-Credentials] [-NoLogo]
Examples
- This command backs up all the keys currently present in the cache.
Export-CacheData -Name demoCache -Path C:\Backup-path
- This command backs up all the keys currently present in the cache with a maximum of 2 MB data files.
Export-CacheData -Name demoCache -Path C:\Backup-path -FileSize 2
- This command backs up all the keys currently present in the cache on server 20.200.20.11.
Export-CacheData -Name demoCache -Path C:\Backup-path -Server 20.200.20.11
- This command backs up all the keys currently present in the cache, using security credentials.
Export-CacheData -Name demoCache -Path C:\Backup-path -Credentials(Get-Credential john_smith)
Properties
Note
The parameters with asterisk (*) on their names are the required parameters and the rest are optional.
| Parameters | Data Types | Description | Default Value |
|---|---|---|---|
-Name* |
<String> |
Specifies the name of the cache which has to be backed up. Note: The cache must already exist on the source server. |
- |
-ErrorThreshold |
<Long> |
Specifies the number of errors that can be tolerated during exporting files to the backup. | 1 |
-FileSize |
<Long> |
Specifies the maximum file size that can be generated during backup. | 5MB |
-Server |
<String> |
Specifies a server name where the NCache Service is running and a cache with the specified cache-name is registered. | IP of local machine |
-Path* |
<String> |
Specifies the path where the backup is to be created. | - |
-Credentials |
<pscredential> |
Specifies the user credentials required to authorize access for the specified operation. These credentials should belong to a user with the appropriate permissions at the node. | - |
-NoLogo |
<SwitchParameter> |
Suppresses display of the logo banner. | False |