Skip to content

Commit

Permalink
- typo chaching > caching
Browse files Browse the repository at this point in the history
- added EventHandler in order to partecipate in cachekey generation
  • Loading branch information
HermesSbicego-Laser committed Oct 19, 2016
1 parent 59a9f0b commit 1dcee8a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -55,7 +56,8 @@ public OutputCacheFilter(
IClock clock,
ICacheService cacheService,
ISignals signals,
ShellSettings shellSettings) {
ShellSettings shellSettings,
ICachingEventHandler cachingEvents) {

_cacheManager = cacheManager;
_cacheStorageProvider = cacheStorageProvider;
Expand All @@ -67,6 +69,7 @@ public OutputCacheFilter(
_cacheService = cacheService;
_signals = signals;
_shellSettings = shellSettings;
_cachingEvents = cachingEvents;

Logger = NullLogger.Instance;
}
Expand Down Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 1dcee8a

Please sign in to comment.