Read-through Caching
NCache uses your custom Read-through provider to communicate with the data source. In Read-through Caching, NCache will call your provider to load data behind the get call, in case of a cache miss. In clustered caches, where multiple servers are involved, the Read-through provider will be active (initialized) on all cache server nodes, but Read-through operations will only be performed by the node that receives the get operation according to the topology being used.
Note
This feature is only available in NCache Enterprise.
Just like Read-through caching, NCache also provides the option of forced Read-through through which the data is fetched from the data source forcefully, regardless of whether the data is present in the cache or not. This means that data will not be checked in the cache and will be fetched directly from the data source.
Note
NCache provides a performance counter Read-thru/sec
for Read-through operations.
The Resync mechanism in NCache keeps the data up to date across the cache. There may be a scenario where the user wants to keep the data synced with the data source. In this case, the data will be synced with the data source whenever an item with resync enabled expires. This way the data in the cache remains fresh and operations are performed on updated data. The NCache Read-through provider can be used as a resync provider by specifying ResyncOptions
while adding a cache item into the cache. ResyncOptions
takes a flag that indicates whether to resync an item on expiration or not. It takes the Read-through provider name as a parameter.
Note
The default Read-through caching provider will be used if the provider name is not specified.
Warning
Do not make calls to the same cache for which Read-through is configured in the provider code. This can cause recursion and can halt the normal working of the cache.
In This Section
Configure Read-Thru Provider
Explains the IReadThruProvider interface and provides a sample implementation for the interface.
Read-Thru with Cache Operations
Provides samples to use Read-through with basic and bulk operations in NCache.