Revert "Virtualizing registration of the cache helper"

This reverts commit 04944f2c0c.
This commit is contained in:
Lars-Erik Aabech
2018-10-21 12:38:01 +02:00
parent 8894df919e
commit ae88932bb8
2 changed files with 20 additions and 33 deletions

View File

@@ -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<CacheHelper>().RuntimeCache);
// register the plugin manager
@@ -228,22 +236,6 @@ namespace Umbraco.Core.Runtime
container.RegisterSingleton<MainDom>();
}
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();

View File

@@ -57,25 +57,20 @@ namespace Umbraco.Web.Runtime
// replace CoreRuntime's IProfiler registration
container.RegisterSingleton(_ => _webProfiler);
container.RegisterSingleton<IHttpContextAccessor, AspNetHttpContextAccessor>(); // 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<IHttpContextAccessor, AspNetHttpContextAccessor>(); // required for hybrid accessors
}
#region Getters