From 48ed511ba55048e71be9a94ab80ac10e2b7c533d Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 6 Oct 2016 09:06:25 +0200 Subject: [PATCH] U4-8983 - clear EntityService cache on content events --- .../Cache/UnpublishedPageCacheRefresher.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Umbraco.Web/Cache/UnpublishedPageCacheRefresher.cs b/src/Umbraco.Web/Cache/UnpublishedPageCacheRefresher.cs index beb5b8db7d..a36ac657a7 100644 --- a/src/Umbraco.Web/Cache/UnpublishedPageCacheRefresher.cs +++ b/src/Umbraco.Web/Cache/UnpublishedPageCacheRefresher.cs @@ -77,6 +77,8 @@ namespace Umbraco.Web.Cache public override void RefreshAll() { + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.IdToKeyCacheKey); + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.KeyToIdCacheKey); ClearAllIsolatedCacheByEntityType(); ClearAllIsolatedCacheByEntityType(); DistributedCache.Instance.ClearDomainCacheOnCurrentServer(); @@ -85,6 +87,8 @@ namespace Umbraco.Web.Cache public override void Refresh(int id) { + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.IdToKeyCacheKey); + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.KeyToIdCacheKey); ClearRepositoryCacheItemById(id); ClearAllIsolatedCacheByEntityType(); content.Instance.UpdateSortOrder(id); @@ -94,6 +98,8 @@ namespace Umbraco.Web.Cache public override void Remove(int id) { + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.IdToKeyCacheKey); + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.KeyToIdCacheKey); ClearRepositoryCacheItemById(id); ClearAllIsolatedCacheByEntityType(); DistributedCache.Instance.ClearDomainCacheOnCurrentServer(); @@ -103,6 +109,8 @@ namespace Umbraco.Web.Cache public override void Refresh(IContent instance) { + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.IdToKeyCacheKey); + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.KeyToIdCacheKey); ClearRepositoryCacheItemById(instance.Id); ClearAllIsolatedCacheByEntityType(); content.Instance.UpdateSortOrder(instance); @@ -112,6 +120,8 @@ namespace Umbraco.Web.Cache public override void Remove(IContent instance) { + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.IdToKeyCacheKey); + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.KeyToIdCacheKey); ClearRepositoryCacheItemById(instance.Id); ClearAllIsolatedCacheByEntityType(); DistributedCache.Instance.ClearDomainCacheOnCurrentServer(); @@ -124,6 +134,8 @@ namespace Umbraco.Web.Cache /// public void Refresh(string jsonPayload) { + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.IdToKeyCacheKey); + ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(CacheKeys.KeyToIdCacheKey); ClearAllIsolatedCacheByEntityType(); foreach (var payload in DeserializeFromJsonPayload(jsonPayload))