Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
Hi,
The following should do:
CacheManager.Insert(cacheKey, objectToCache, new CacheEvictionPolicy( new string[1] {DataFactoryCache.ChildrenCacheKey(parentPage.ContentLink)}, TimeSpan.FromMinutes(5), CacheTimeoutType.Sliding));
Thanks, M
Hi,
DataFactoryCache.ChildrenCacheKey is deprecated, so I used IContentCacheKeyCreator.CreateChildrenCacheKey instead. Like this;
var expiration = TimeSpan.FromSeconds(timeoutInSeconds); var cacheKeys = new List<string>() { _contentCacheKeyCreator.CreateChildrenCacheKey(contentReference, null) }; var evictionPolicy = new CacheEvictionPolicy(expiration, CacheTimeoutType.Absolute, cacheKeys);
The problem is that the cachekey generated from CreateChildrenCacheKey only covers the child pages. I want my cache to be refreshed when ANY descendant page is updated.
/Jimmy
I created my own caching invalidation for this reason (you can have descendants and also contenttype as dependency). Then in content events I check updated/created/deleted/moved pages and invalidate cache. It was for an older version though. I'll try to blog about it in a few days and port it to the latest version :)
Hi,
I need to create a cache eviction policy that is covering changes on all descendant pages of a page. With IContentCacheKeyCreator.CreateChildrenCacheKey I can create a cache key for all child pages of a page. Can I use IContentCacheKeyCreator.CreateSegmentCacheKey in someway to achieve this?
Regards,
Jimmy