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?