diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs
index 548012e6bac..b8ddff8398e 100644
--- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs
+++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs
@@ -41,6 +41,7 @@ public class OutputCacheFilter : FilterProvider, IActionFilter, IResultFilter, I
private readonly ICacheService _cacheService;
private readonly ISignals _signals;
private readonly ShellSettings _shellSettings;
+ private readonly ICachingEventHandler _cachingEvents;
private bool _isDisposed = false;
public ILogger Logger { get; set; }
@@ -55,7 +56,8 @@ public OutputCacheFilter(
IClock clock,
ICacheService cacheService,
ISignals signals,
- ShellSettings shellSettings) {
+ ShellSettings shellSettings,
+ ICachingEventHandler cachingEvents) {
_cacheManager = cacheManager;
_cacheStorageProvider = cacheStorageProvider;
@@ -67,6 +69,7 @@ public OutputCacheFilter(
_cacheService = cacheService;
_signals = signals;
_shellSettings = shellSettings;
+ _cachingEvents = cachingEvents;
Logger = NullLogger.Instance;
}
@@ -610,6 +613,14 @@ protected virtual string ComputeCacheKey(string tenant, string absoluteUrl, IEnu
}
}
+ //make CacheKey morphable by external modules
+ try {
+ keyBuilder = _cachingEvents.ParticipateInCacheKey(keyBuilder);
+ } catch (UnauthorizedAccessException ex) {
+ throw new UnauthorizedAccessException();
+ } catch { }
+
+
return keyBuilder.ToString();
}
diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/ICachingEventHandler.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/ICachingEventHandler.cs
new file mode 100644
index 00000000000..6e9aebf5a7b
--- /dev/null
+++ b/src/Orchard.Web/Modules/Orchard.OutputCache/ICachingEventHandler.cs
@@ -0,0 +1,12 @@
+using Orchard.Events;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web;
+
+namespace Orchard.OutputCache {
+ public interface ICachingEventHandler : IEventHandler {
+ StringBuilder ParticipateInCacheKey(StringBuilder key);
+ }
+}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Orchard.OutputCache.csproj b/src/Orchard.Web/Modules/Orchard.OutputCache/Orchard.OutputCache.csproj
index a3a7fa74c7f..9a4520288d4 100644
--- a/src/Orchard.Web/Modules/Orchard.OutputCache/Orchard.OutputCache.csproj
+++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Orchard.OutputCache.csproj
@@ -103,6 +103,7 @@
+