Configuring Write-Through Provider
This feature is only available in NCache Enterprise.
To preserve the cache data in some persistent storage, you can configure Write-Through providers for a cache. By using the Write-Through provider, the cached data and data added/updated/removed are synchronized with a data source.
Using the NCache Management Center
Launch the NCache Management Center by browsing to http://localhost:8251 or
<server-ip>:8251on Windows and Linux.
In the left navigation bar, click on Clustered Caches or Local Caches, based on the cache to which the query index will be added. Against the cache name, click on View Details.
Make sure that the cache is stopped.
This opens up the detailed configuration page for the cache. Go to the Advanced Settings tab and click on Backing Source in the left bar.
Check the Enable Write Through box. Choose to add a provider.
A new page will open up. Enter the Provider Name in the text box and then click on the "..." button to browse for assembly implementing the
IWriteThruProviderinterface. Select the class name from the drop-down list.
Select the required Write-Through provider.
- You can also provide the values to your Write-Through provider class if required. Specify the parameter name in the Parameter field and its value against it under the Value field.
These parameters, along with their assigned values, are passed to the selected Write-Through provider when it is initialized on cache start. Providing the parameters is optional.
The selected provider class will be listed in the Read-Through provider list in the Backing Source tab.
- Deploy the Write-Through provider assembly along with its dependent assemblies if any. Click on the Deploy Backing Source Provider button at the bottom left of the Backing Source tab page. Browse for the required assemblies, select all of the required assemblies, and click Open.
- After applying all the changes click on Save Changes.
Using Command Line Tools
The Add-BackingSource cmdlet enables users to configure backing source (read-through, write-through) providers for the specified cache.
This command configures Writer1 as the write-through provider on demoClusteredCache.
Add-BackingSource demoClusteredCache -AssemblyName C:\Downloads\Providers.dll -Class NCache.Sample.Providers.Writers.Writer1 -ProviderName writer1 -WriteThru
Remove-BackingSource cmdlet removes the pre-configured backing source providers (read-through or write-through) from the cache or a specified server.
The following command removes the pre-configured write-through provider named Writer1 from the demoClusteredCache existing on server 184.108.40.206.
Remove-BackingSource demoClusteredCache -ProviderName MyWriter –WriteThru –Server 220.127.116.11