Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
namespace Discovering.Sitecore10.Caching
public class OutputCacheOptions
public bool Enabled { get; set; }
public class OutputCacheTagHelper : CacheTagHelper
public OutputCacheTagHelper(
CacheTagHelperMemoryCacheFactory factory,
HtmlEncoder htmlEncoder,
IHttpContextAccessor httpContextAccessor,
IOptions<OutputCacheOptions> cachingOptions,
IOutputCacheService outputCacheService)
: base(factory, htmlEncoder)
ExpiresOn = DateTimeOffset.MaxValue;
VaryBy = httpContextAccessor.HttpContext.Request.Path + "," + outputCacheService.GetLastCacheReload().ToString(CultureInfo .InvariantCulture);
Enabled = cachingOptions.Value.Enabled;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.