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