mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-19 19:57:01 +08:00
Improving output cache filter.
- This change allows any shapes to be added to the Messages zone without causing the output cache to not kick in anymore. - Using INotifier instead of INotificationManager to prevent invocation of INotificationProvider implementations.
This commit is contained in:
@@ -19,6 +19,7 @@ using Orchard.Mvc.Filters;
|
||||
using Orchard.Services;
|
||||
using Orchard.Themes;
|
||||
using Orchard.UI.Admin;
|
||||
using Orchard.UI.Notify;
|
||||
using Orchard.Utility.Extensions;
|
||||
using System.Collections.Specialized;
|
||||
using Orchard.OutputCache.ViewModels;
|
||||
@@ -39,6 +40,7 @@ namespace Orchard.OutputCache.Filters {
|
||||
private readonly ISignals _signals;
|
||||
private readonly ShellSettings _shellSettings;
|
||||
private readonly ICacheControlStrategy _cacheControlStrategy;
|
||||
private readonly INotifier _notifier;
|
||||
|
||||
TextWriter _originalWriter;
|
||||
StringWriter _cachingWriter;
|
||||
@@ -57,8 +59,9 @@ namespace Orchard.OutputCache.Filters {
|
||||
ICacheService cacheService,
|
||||
ISignals signals,
|
||||
ShellSettings shellSettings,
|
||||
ICacheControlStrategy cacheControlStrategy
|
||||
) {
|
||||
ICacheControlStrategy cacheControlStrategy,
|
||||
INotifier notifier) {
|
||||
|
||||
_cacheManager = cacheManager;
|
||||
_cacheStorageProvider = cacheStorageProvider;
|
||||
_tagCache = tagCache;
|
||||
@@ -70,6 +73,7 @@ namespace Orchard.OutputCache.Filters {
|
||||
_signals = signals;
|
||||
_shellSettings = shellSettings;
|
||||
_cacheControlStrategy = cacheControlStrategy;
|
||||
_notifier = notifier;
|
||||
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
@@ -343,9 +347,7 @@ namespace Orchard.OutputCache.Filters {
|
||||
}
|
||||
|
||||
// don't cache the result if there were some notifications
|
||||
// notifications can come from Notifier and NotificationProvider
|
||||
var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"] as Shape;
|
||||
if (messagesZone != null && messagesZone.Items.Any()) {
|
||||
if (_notifier.List().Any()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user