Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/5790 participate in cache key generation #7334

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,9 @@ protected virtual string ComputeCacheKey(string tenant, string absoluteUrl, IEnu
}
}

//make CacheKey morphable by external modules
_cachingEvents.KeyGenerated(keyBuilder);

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 {
void KeyGenerated(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