Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Issue with cache dependency

$
0
0

I am using the following code to cache the model of a block:

 _objectInstanceCache.Insert(cacheKey, model, new CacheEvictionPolicy(new TimeSpan(1, 0, 0), CacheTimeoutType.Absolute));

This works as expected. Now if I add a cache dependency (to content version) the model is never fetched from the cache, _objectInstanceCache.Get(cacheKey) always return null! I use the following code to add to the cache with cachedependency:

var cacheDepKeys = new List() { _cacheKeyCreator.CreateVersionCacheKey(content.ContentLink) };
_objectInstanceCache.Insert(cacheKey, model, new CacheEvictionPolicy(new TimeSpan(1, 0, 0), CacheTimeoutType.Absolute, cacheDepKeys));
// _cacheKeyCreator is of type Episerver.Core IContentCacheKeyCreator 

Have anyone seen similar behavior? 


Viewing all articles
Browse latest Browse all 9076

Trending Articles