NCache 4.6 - Online Documentation

Read-Through Provider

 
A requested value not present in the cache can be automatically obtained from the main data source by NCache and provided to the user in such a manner that it seems to the caller that it came from the cache. This is known as Read Through cache. The gain from it is that the application can depend on the cache for both cached data as well as for transparent data loading instead of adding data loading logic at the point where it requires the data. Read-Through caching can be configured using the following methods.
 
Using NCache Manager
 
  • Click on the cache name in Cache Explorer to open cache settings.
 
  • Go to the 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 the 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.
 
 
  • Selected provider class will be listed in Read-Through provider list at Backing Source tab.
 
 
  • 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.
 
 
  • Right click the cache in Cache Explorer and select Apply Configuration option.
 
Using Command Tool
 
  • Open command prompt.
 
  • Go to the NCache tools directory: cd %NCHOME%/bin/tools
 
  • Use addbackingsource.exe tool, provide the required information as:
addbackingsource.exe demoLocalCache /path C:\Users\Administrator\Downloads\Providers\Providers.dll/cNCache.Sample.Providers.Readers.Reader1 /pnreader1/R
 
  • Press ENTER, it will configure Reader1 Read-Through provider on demoLocalcache.
 
  • Now deploy all of the required assemblies (assembly in which you have implemented the Read-Through provider and all of its dependency assemblies) using deployprovider.exe. Use following command on command prompt:
deployprovider demoLocalCache /T C:\Users\Administrator\Downloads\Providers\
 
  • Press ENTER, it will deploy all of the assemblies from the given path to NCache deploy folder.
 
 
See Also