From ae88932bb89fee439d7329c9f14d0bbd5cf03b6e Mon Sep 17 00:00:00 2001 From: Lars-Erik Aabech Date: Sun, 21 Oct 2018 12:38:01 +0200 Subject: [PATCH] Revert "Virtualizing registration of the cache helper" This reverts commit 04944f2c0ca87096c1cb7fa7053c37a804985fbd. --- src/Umbraco.Core/Runtime/CoreRuntime.cs | 26 +++++++++--------------- src/Umbraco.Web/Runtime/WebRuntime.cs | 27 ++++++++++--------------- 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/src/Umbraco.Core/Runtime/CoreRuntime.cs b/src/Umbraco.Core/Runtime/CoreRuntime.cs index dfe9c5d9f9..0ad621b97c 100644 --- a/src/Umbraco.Core/Runtime/CoreRuntime.cs +++ b/src/Umbraco.Core/Runtime/CoreRuntime.cs @@ -195,7 +195,15 @@ namespace Umbraco.Core.Runtime container.ComposeConfiguration(); - RegisterCacheHelper(container); + // register caches + // need the deep clone runtime cache profiver to ensure entities are cached properly, ie + // are cloned in and cloned out - no request-based cache here since no web-based context, + // will be overriden later or + container.RegisterSingleton(_ => new CacheHelper( + new DeepCloneRuntimeCacheProvider(new ObjectCacheRuntimeCacheProvider()), + new StaticCacheProvider(), + NullCacheProvider.Instance, + new IsolatedRuntimeCache(type => new DeepCloneRuntimeCacheProvider(new ObjectCacheRuntimeCacheProvider())))); container.RegisterSingleton(f => f.GetInstance().RuntimeCache); // register the plugin manager @@ -228,22 +236,6 @@ namespace Umbraco.Core.Runtime container.RegisterSingleton(); } - protected virtual void RegisterCacheHelper(IContainer container) - { -// register caches - // need the deep clone runtime cache profiver to ensure entities are cached properly, ie - // are cloned in and cloned out - no request-based cache here since no web-based context, - // will be overriden later or - container.RegisterSingleton( - "CacheHelper", - _ => new CacheHelper( - new DeepCloneRuntimeCacheProvider(new ObjectCacheRuntimeCacheProvider()), - new StaticCacheProvider(), - NullCacheProvider.Instance, - new IsolatedRuntimeCache(type => - new DeepCloneRuntimeCacheProvider(new ObjectCacheRuntimeCacheProvider())))); - } - protected virtual void ComposeMapperCollection(MapperCollectionBuilder builder) { builder.AddCore(); diff --git a/src/Umbraco.Web/Runtime/WebRuntime.cs b/src/Umbraco.Web/Runtime/WebRuntime.cs index 424a3e4504..38c0c5ad50 100644 --- a/src/Umbraco.Web/Runtime/WebRuntime.cs +++ b/src/Umbraco.Web/Runtime/WebRuntime.cs @@ -57,25 +57,20 @@ namespace Umbraco.Web.Runtime // replace CoreRuntime's IProfiler registration container.RegisterSingleton(_ => _webProfiler); - container.RegisterSingleton(); // required for hybrid accessors - } - - protected override void RegisterCacheHelper(IContainer container) - { // replace CoreRuntime's CacheHelper registration - container.RegisterSingleton( - "CacheHelper", - _ => new CacheHelper( + container.RegisterSingleton(_ => new CacheHelper( + // we need to have the dep clone runtime cache provider to ensure + // all entities are cached properly (cloned in and cloned out) + new DeepCloneRuntimeCacheProvider(new HttpRuntimeCacheProvider(HttpRuntime.Cache)), + new StaticCacheProvider(), + // we need request based cache when running in web-based context + new HttpRequestCacheProvider(), + new IsolatedRuntimeCache(type => // we need to have the dep clone runtime cache provider to ensure // all entities are cached properly (cloned in and cloned out) - new DeepCloneRuntimeCacheProvider(new HttpRuntimeCacheProvider(HttpRuntime.Cache)), - new StaticCacheProvider(), - // we need request based cache when running in web-based context - new HttpRequestCacheProvider(), - new IsolatedRuntimeCache(type => - // we need to have the dep clone runtime cache provider to ensure - // all entities are cached properly (cloned in and cloned out) - new DeepCloneRuntimeCacheProvider(new ObjectCacheRuntimeCacheProvider())))); + new DeepCloneRuntimeCacheProvider(new ObjectCacheRuntimeCacheProvider())))); + + container.RegisterSingleton(); // required for hybrid accessors } #region Getters