CacheDependency on all EPiServer PageData?

I'd like to invalidate some chached objects in the EPiServer Cache class (aka the global ASP.NET Cache class?) whenever any PageData is changed. Any ideas? Does EPiServer keep any Cache objects that updates on these kinds of changes, that I could use as key for CacheDependency?
Nov 14, 2005 23:49
Yepp, you can, and you should, and you should have a price for thinking about it :-) This will do the trick: // Make the cache object dependent on the EPiServer // cache, so it will be removed when new pages are // published, deleted or we are notified by // another server that the cache needs refreshing String[] pageCacheDependencyKey = new String[1]; pageCacheDependencyKey[0] = DataFactoryCache.VersionKey; CacheDependency dependency = new CacheDependency(null, pageCacheDependencyKey); // Add to cache, without dependencies and expiration // policies. If the cached item should be cached for // limited time (regardsless of the cache dependency), // add an absolute expiration date or a sliding expiration // to the item. // Also note, we use the Insert method that will overwrite // any existing cache item with the same key. The Add method // will throw an exception if an item with the same key exists. HttpContext.Current.Cache.Insert(cacheKey, SOMETHING, dependency); /Steve
Nov 15, 2005 23:24
VersionKey... Obvious when you say it. Brilliant. Thanks.
Nov 16, 2005 0:12
What about delayed publish pages? From what I can see, when pages become expired (ie pass their publish stop date), their DataFactoryCache.VersionKey doesn't change, therefore the cache dependency isn't activated? Does anyone have a suggestion for how to handle this situation?
Sep 24, 2007 4:00
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.