In a Windows application, I'm using Microsoft's Caching Block to store some static data I retrieve from a web service.
I've set the expiration as SlidingTime(TimeSpan.FromMinutes(10)) when adding a value into the cache manager.
However, I've noticed that calls to ICacheItemRefreshAction.Refresh are happening on a worker thread that most likely the Caching Block creates itself. Therefore there could be a situation when a call to ICachingManager.GetData(key) may not return anything
because the data has already been removed from the cache and the Refresh() method has not finished retrieving the new data yet.
Is there a way to get notified when it's time to refresh the data in cache yet at the same time keep the old data in cache?
Is there any other better solution than the Caching Block for this kind of a scenario?
DashNYC
Member
4 Points
8 Posts
Caching data without expiring but with refresh notification
Feb 01, 2011 01:26 PM|LINK
Hi there,
In a Windows application, I'm using Microsoft's Caching Block to store some static data I retrieve from a web service.
I've set the expiration as SlidingTime(TimeSpan.FromMinutes(10)) when adding a value into the cache manager.
However, I've noticed that calls to ICacheItemRefreshAction.Refresh are happening on a worker thread that most likely the Caching Block creates itself. Therefore there could be a situation when a call to ICachingManager.GetData(key) may not return anything because the data has already been removed from the cache and the Refresh() method has not finished retrieving the new data yet.
Is there a way to get notified when it's time to refresh the data in cache yet at the same time keep the old data in cache?
Is there any other better solution than the Caching Block for this kind of a scenario?
Thank you
-D.