AI OnAI Off
NB! In the latest Episerver version (9.7.2) DataFactoryCache is marked deprecated, and the VersionKey should be retrieved from IContentCacheKeyCreator.VersionKey property instead of static DataFactoryCache.VersionKey. But this should not be an issue because the old interfaces are now wrappers for new implementations and the VersionKey is still the same. The reason I am sticking with the old is to keep 9.x compatibility with our Nuget packages that use caching:
Hi,
I noticed that when using "DataFactoryCache.Version" cache dependency in a load balanced environment, sometimes the caching stopped working completely. After some debugging I found the reason; the entry "DataFactoryCache.Version" was not present in the cache, and if a cache dependency is not present, the entry is not cached at all.
It seems that when a remote cache is updated, the"DataFactoryCache.Version" entry is removed completely, whereas with local cache it is updated.
One simple workaround is to ensure that the dependency is present before inserting the entry. Little code digging revealed that getting DataFactoryCache.Version property has side-effects which ensure the dependency is cached (both in 9.0.0 and 9.7.2, though the inner workings differ a lot). So, we can wrap-up the workaround like this:
With this I can fix custom caching issues. But from what I can tell, it looks that EPiServer.Find.Cms.SearchRequestExtensions.GetContentResult is also affected by the same issue.
Have you noticed this issue, and if so, what workarounds have you applied? I was thinking that if this is a common issue, then perhaps Episerver might update the cache version on remote servers when they receive remote cache removal event.