NCache 4.3 - Online Documentation

Resync Expired Items

 
The expired items of the cache are required to be reloaded from the main data source. The idea of Resync Expired Items is that, instead of removing items from the cache, they are placed in a queue, awaiting to be automatically reloaded from the main data source when updated. An obsolete expired item is moved to the top of the queue for immediate updating when accessed. This ensures providing of updated data to the user. With Resync Expired Items enabled, no item expires ever unless it is removed from the data source. Hence, automatic synchronization with the master data source occurs. For Resync Expired Items, Read Through cache must be enabled and include the following namespace in your application:
 
using Alachisoft.NCache.Web.Caching;
 
While adding items to the cache, Resync Expired Items needs to be enabled for individual items. For reference, see the code below:
 
CacheItem item = new CacheItem (customer);
item.SlidingExpiration = new TimeSpan (0, 0, 30);
item.IsResyncExpiredItems = true ; //Resync Expired Items is enabled.
Cache _cache = NCache.InitializeCache( "myCache" );
_cache.Insert(customer.CustomerID, item);
 
 
See Also
 
© Copyright  2014 Alachisoft. All rights reserved.