Add-BackingSource
The Add-BackingSource PowerShell cmdlet in NCache enables you to configure Read-Through and Write-Through providers for an existing cache, facilitating seamless integration with backend data sources. This cmdlet allows you to automatically fetch data on cache misses or synchronously update the database with cache writes. It also supports advanced features like batching, requeueing, and connection string parameters for optimized performance. This ensures efficient data retrieval, synchronization, and high throughput in distributed caching environments.
Warning
Make sure that the cache has been stopped before proceeding to execute this cmdlet.
Add-BackingSource –AssemblyPath -CacheName –Class [-DependentAssemblyPath] -ProviderName [-BatchInterval] [-DefaultProvider] [-isBatching] [-NoDeploy] [-NoLogo] [-OperationDelay] [-OperationEvictionRatio] [-OperationPerSecond] [-OperationQueueLimit] [-Parameters] [-Port] -ReadThru [-Server] [-Credentials] -WriteThru
Examples
Important
Please note that either the ReadThru or WriteThru parameter must be specified when using this cmdlet.
- This command configures Read-through provider for demoCache.
Add-BackingSource -CacheName demoCache -AssemblyPath C:\ReadThru.dll -Class ReadThru.Reader -ProviderName MyReader -ReadThru
- This command configures Write-through provider for demoCache.
Add-BackingSource -CacheName demoCache -AssemblyPath C:\WriteThru.dll -Class WriteThru.Writer -ProviderName MyWriter -WriteThru
- This command configures Write-through provider with batching enabled, for demoCache that exists on server 20.200.20.11.
Add-BackingSource -CacheName demoCache -AssemblyPath C:\Provider.dll -Class WriteThrough.Writer -ProviderName MyWriter -WriteThru -Server 20.200.20.11 -isBatching
- This command configures Write-through provider with batching enabled, OperationDelay 10ms, BatchInterval 5s, OperationPerSecond 500, OperationQueueLimit 3000, OperationEvictionRatio 5% and Parameters which are key value pairs,
_connectionString= “Server=localhost;Database=Northwind;Trusted_Connection=True;”andLoggerInfo=“Server=localhost;Database=TestLogger;Trusted_Connection=True;”for demoCache that exists on server 20.200.20.11.
Add-BackingSource -CacheName demoCache -AssemblyPath C:\Provider.dll -class WriteThrough.Writer -ProviderName MyWriter -WriteThru -Server 20.200.20.11 -isBatching -OperationDelay 10 -BatchInterval 5 -OperationPerSecond 500 -OperationQueueLimit 3000 -OperationEvictionRatio 5 -Parameters _connectionString="Server=localhost; Database=Northwind;Trusted_Connection=True;"'$'"LoggerInfo=Server=localhost;Database=TestLogger;Trusted_Connection=True;"
- This command configures Read-through provider for demoCache using security credentials.
Add-BackingSource -CacheName demoCache -AssemblyPath C:\ReadThru.dll -Class ReadThru.Reader -ProviderName MyReader -ReadThru -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 |
|---|---|---|---|
-AssemblyPath* |
<String> |
Specifies the path of the assembly which will be configured as a backing source. | - |
-CacheName* |
<String> |
Specifies the name of the cache for which backing source will be configured. Note: The cache must already exist on the source server. |
- |
-Class* |
<String> |
Specifies the fully qualified class from the backing source assembly which implements ReadThru/WriteThru. | - |
-DependentAssemblyPath |
<String> |
Specifies the dependent assembly folder/path. | - |
-ProviderName* |
<String> |
Specifies the provider name. | - |
-BatchInterval |
<Integer> |
Specifies periodic interval for operation expiration. | 5 |
-DefaultProvider |
<SwitchParameter> |
Specifies the default provider in case of multiple providers. | False |
-isBatching |
<SwitchParameter> |
Specifies whether you want to enable batching or not. | False |
-NoDeploy |
<SwitchParameter> |
Specifies if no assembly should be deployed. | False |
-NoLogo |
<SwitchParameter> |
Suppresses the display of the logo banner. | False |
-OperationDelay |
<Integer> |
Specifies the time that cache suspends each operation write on data source. | 0 |
-OperationEvictionRatio |
<Integer> |
Specifies the failed operations eviction ratio. | 5 |
-OperationPerSecond |
<Integer> |
Specifies the rate at which cache writes the updates to the database. | 1 |
-OperationQueueLimit |
<Integer> |
Specifies the maximum operation count to be re-queued in case of data source write operation failure. | 5000 |
-Parameters |
<String> |
Specifies the list of the parameters passed to the backing source provider separated by ‘$’. | - |
-Port |
<Integer> |
Specifies the port on which NCache Service is running. | 8250 |
-ReadThru* |
<SwitchParameter> |
Specifies if provided backing source is configured for ReadThru. | False |
-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 |
-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. | - |
-WriteThru* |
<SwitchParameter> |
Specifies if provided backing source is configured for WriteThru. | False |