Alachisoft NCache 4.1 - Online Documentation

Read-through and Write-through

 
While working with data sources, it is important to transparently fetch required data from the master data source if it is not available in the cache and vice versa. Read-Through and Write-through are provided by NCache for this purpose. Now you can add multiple Read-Through and Write-through providers with your applications in case of multiple data sources.
This configuration option is available for both Local and Clustered Caches. You can enable this behavior for your cache from Backing Source Tab of their view window.
 
 
Read through Caching
 
A requested value not present in the cache can be automatically obtained from the main data source by the cache 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.
Just like Read Through, data can be written back to the data store as well to keep it updated. NCache provides two ways of achieving this.
 
Write through Caching
 
The idea behind Write Through cache is that when an application updates a piece of data in the cache, the operation is not completed until the changed data has been successfully stored in the underlying data source. Though this enhances data integrity, but effects the performance negatively in terms of the latency involved in writing to the data store. This latency can be overcome by Write Behind caching
 
 
Write Behind Caching
 
Unlike write through, write behind caching writes to the data store after some configurable time. The data that needs to be written to the data source is placed in a queue and after the specified duration, it is written to the main data source. This improves the performance as there is no write latency involved. It decreases the load on the database as well, as the Reads to the database are made from the cache and the Writes which are more expensive can be reduced by combining them into a single write. It boosts scalability as well as reduce the load by increasing number of users on the data source.
 
 
See Also
 
Copyright © 2005-2012 Alachisoft. All rights reserved.