Moves cache initialization the the request middleware

This commit is contained in:
Shannon
2020-12-14 16:55:45 +11:00
parent 776df77dfe
commit fc16669a91
2 changed files with 32 additions and 20 deletions

View File

@@ -37,7 +37,6 @@ namespace Umbraco.Extensions
// We need to add this before UseRouting so that the UmbracoContext and other middlewares are executed
// before endpoint routing middleware.
app.UseUmbracoRouting();
app.UseUmbracoContentCache();
app.UseStatusCodePages();
@@ -178,18 +177,6 @@ namespace Umbraco.Extensions
return app;
}
/// <summary>
/// Enables the Umbraco content cache
/// </summary>
public static IApplicationBuilder UseUmbracoContentCache(this IApplicationBuilder app)
{
// TODO: This should install middleware to initialize instead of eagerly doing the initialize here
PublishedSnapshotServiceEventHandler publishedContentEvents = app.ApplicationServices.GetRequiredService<PublishedSnapshotServiceEventHandler>();
publishedContentEvents.Start();
return app;
}
/// <summary>
/// Ensures the runtime is shutdown when the application is shutting down
/// </summary>