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.
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
//=System.Configuration.ConfigurationSettings.AppSettings["connstring"].ToString();
- 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
'Directory.Providers.Sql'
- Set the read-though Class Name to
'Directory.Providers.SqlReadThruProvider'
- Click the Add button and add the parameter with name: connstring and value:
yourconnectionstringhere. Please make sure that these strings are without double
quotes.
- Do the above steps for WriteThru section as well except for the class name,
Set the write-through Class Name to
'Directory.Providers.SqlWriteThruProvider'
- 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?