[Feature #5790] Adding cache key generation extensibility (#7334)

This commit is contained in:
Hermes Sbicego
2016-10-27 22:11:50 +02:00
committed by Sébastien Ros
parent ae1aaff146
commit b931b79115
3 changed files with 20 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ namespace Orchard.OutputCache.Filters {
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 @@ namespace Orchard.OutputCache.Filters {
IClock clock,
ICacheService cacheService,
ISignals signals,
ShellSettings shellSettings) {
ShellSettings shellSettings,
ICachingEventHandler cachingEvents) {
_cacheManager = cacheManager;
_cacheStorageProvider = cacheStorageProvider;
@@ -67,6 +69,7 @@ namespace Orchard.OutputCache.Filters {
_cacheService = cacheService;
_signals = signals;
_shellSettings = shellSettings;
_cachingEvents = cachingEvents;
Logger = NullLogger.Instance;
}
@@ -616,6 +619,9 @@ namespace Orchard.OutputCache.Filters {
}
}
//make CacheKey morphable by external modules
_cachingEvents.KeyGenerated(keyBuilder);
return keyBuilder.ToString();
}

View File

@@ -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 {
void KeyGenerated(StringBuilder key);
}
}

View File

@@ -103,6 +103,7 @@
<Content Include="Web.config" />
<Content Include="Scripts\Web.config" />
<Content Include="Styles\Web.config" />
<Compile Include="ICachingEventHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Content Include="Module.txt" />
</ItemGroup>