Configuring Read-Through Provider
Read-Through provider can be configured in following ways:
Using NCache Manager
Click on the cache name in Cache Explorer to open the cache settings.
Go to Backing Source tab.
Check Enable Read-Through check box to enable it. After enabling it, other options will get enabled as well.
Click Add to select assembly that has
IReadThruProvider
implementation.A new dialog box Add New Provider will open.
Enter Provider Name and click on ‘…’ button to browse for assembly implementing
IReadThruProvider
interface.Browse for the required assembly and select Open.
Name of selected assembly will be appeared in Assembly Name and its classes implementing interface will be listed down in Class Name list box.
Select the required Read-Through provider. You can also provide the values to your read-through provider class, if required. Just write the parameter name in Parameter field and its value against it under the Value field.
Click OK.
Note
These parameters, along with their assigned values, are passed to the selected Read-Through provider when it is initialized on cache start. Providing the parameters is optional.
Selected provider class will be listed in Read-Through provider list at Backing Source tab.
Note
You can configure multiple Read-Through providers for a cache.
Now deploy the read-through provider assembly along with its dependency assemblies, if any. Click on the Deploy Provider button at the left bottom of the Backing Source tab.
Browse for required assemblies.
Select all the required assemblies and click Open.
Apply the configurations by right clicking on cache name in Cache Explorer and selecting Apply Configuration option.
Using Windows PowerShell
Configure Read-Through
Add-BackingSource
cmdlet enable users to configure backing source (read-through, write-through) providers for the specified cache.
The following Command will configure Reader1 read-through provider on demoLocalCache.
Add-BackingSource demoLocalCache AssemblyName C:\Providers\Providers.dll -Class
NCache.Sample.Providers.Readers.Reader1 -ProviderName reader1 -ReadThru
Remove Read-Through
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 read-through provider named MyReader from demoLocalCache.
Remove-BackingSource -CacheName demoLocalCache -ProviderName MyReader –ReadThru