How to Configure Read Through and Write Through for NCache

NCache facilitates the way you synchronize your database with NCache and keep the data consistent and reliable in the cache. NCache has various features to help you do this. Let’s see how we can use the ReadThru, WriteThru and IsResyncExpired features of NCache using the sample program name “Directory” that comes with the installation of NCache.

Directory Sample Configuration Settings for XML ReadThru / WriteThru:

Customers can search our extensive online documentation, FAQ's, online support forum, articles and online demos 24 hours a day. Our online resources provide a wealth of information on many topics and provide quick answers to most common questions.

  • Build the Directory sample in Visual Studio .NET.
  • Copy the Directory.Providers.Xml.dll from


  • In the NCache Manager, make a new project, right click the clustered caches and add an existing cache named "mycache".
  • Right click "mycache" and stop the cache.
  • Double click "mycache" and go to Backing Source tab in the right pane.
  • Enable ReadThru and in this section add the following in the text field:
         Assembly name: Directory.Providers.Xml
         Class Name: Directory.Providers.XmlReadThruProvider
  • Enable WriteThru and in this section add the following:
         Assembly name: Directory.Providers.Xml
         Class Name: Directory.Providers.XmlWriteThruProvider
  • Right click "mycache" and apply configurations.
  • Right click and start the cache.
  • You are ready to run the Directory sample application from visual studio.

Directory Sample Configuration Settings for SQL:

  • Stop "mycache". Open the Directory sample in visual studio.
  • In Directory.Providers.Sql.SqlDatasource.cs file modify line 23 as below:
         private string _connString
  • Rebuild the sample.
  • Copy the Directory.Providers.Sql.dll from the sample folder to NCache service directory as specified in the above section.
  • In the NCache Manager under the backing source tab, set the Assembly Name to
  • Set the read-though Class Name to
  • Click the Add button and add the parameter with name: connstring and value:
         yourconnectionstringhere. Please make sure that these strings are without double
  • Do the above steps for WriteThru section as well except for the class name,
         Set the write-through Class Name to
  • Add the parameter "connstring" as above.
  • Right Click your cache and apply configurations.
  • Right Click and start the cache.
  • You are ready to run the Directory sample for SQL ReadThru WriteThru testing.

The procedure to configure the OleDb ReadThru/WriteThru is the same as for SQL. You would be able to do that once you are done with the above 2.

Read more on how to configure Read-thru and Write-thru from NCache Manager here.


What to Do Next?

© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.