Last active
October 10, 2016 11:02
-
-
Save carlwoodhouse/eb6ddefcc7e9b2a30dbc517b6a3e67c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Web.Mvc; | |
| using Orchard; | |
| using Orchard.Caching; | |
| using Orchard.Environment.Configuration; | |
| using Orchard.Environment.Extensions; | |
| using Orchard.OutputCache.Filters; | |
| using Orchard.OutputCache.Models; | |
| using Orchard.OutputCache.Services; | |
| using Orchard.Services; | |
| using Orchard.Themes; | |
| namespace Patient.Framework.Caching.OutputCache { | |
| [OrchardFeature("Patient.Framework.Caching.OutputCache")] | |
| [OrchardSuppressDependency("Orchard.OutputCache.Filters.OutputCacheFilter")] | |
| public class OutputCacheFilterOverride : OutputCacheFilter { | |
| public OutputCacheFilterOverride( | |
| ICacheManager cacheManager, | |
| IOutputCacheStorageProvider cacheStorageProvider, | |
| ITagCache tagCache, | |
| IDisplayedContentItemHandler displayedContentItemHandler, | |
| IWorkContextAccessor workContextAccessor, | |
| IThemeManager themeManager, | |
| IClock clock, | |
| ICacheService cacheService, | |
| ISignals signals, | |
| ShellSettings shellSettings) : | |
| base( | |
| cacheManager, cacheStorageProvider, tagCache, displayedContentItemHandler, workContextAccessor, | |
| themeManager, clock, cacheService, signals, shellSettings) { | |
| } | |
| protected override IDictionary<string, object> GetCacheKeyParameters(System.Web.Mvc.ActionExecutingContext filterContext) { | |
| var result = base.GetCacheKeyParameters(filterContext); | |
| var ignoreList = new List<string> { "utm1", "utm2" }; | |
| // you could remove stuff from the result here which you dont wanna cache by in terms of the querystring | |
| if (result != null && result.Any()) { | |
| foreach(var item in ignoreList { | |
| if (result.ContainsKey(item)) { | |
| result.Remove(item); | |
| } | |
| } | |
| } | |
| return result; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment