• Webinars
  • Docs
  • Download
  • Blogs
  • Contact Us
Try Free
Show / Hide Table of Contents

Read-Through Caching

Note

This feature is only available in NCache Enterprise Edition.

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, Read-Through provider will be active (initialized) on all cache server nodes but Read-Through operations will be performed by the node which receives get operation according to the topology.

Just like Read-Through, NCache also provides the option of forced Read-through through which the data is fetched from the data source forcefully regardless of the data being 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.

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 is expired. This way the data in the cache remains fresh and operations are performed on the updated data. NCache Read-Through provider can be used as resync provider by specifying ResyncOptions while adding cache item in cache. ResyncOptions take a flag that indicates whether to resync item on expiration or not. It optionally takes Read-Through provider name as a parameter.

Note

Default Read-Through provider will be used if 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 cache.

In This Section

Read-Through Provider Configuration and Implementation
Explains the IReadThruProvider interface and provides a sample implementation for the interface.

Read-Through Usage with Cache Operation
Provides samples to use Read-Through with basic and bulk operations in NCache.

Back to top Copyright © 2017 Alachisoft