CacheTagHelper Class

Summary

@!:TagHelper- implementation targeting <cache> elements.

Syntax

public class CacheTagHelper : TagHelper

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.TagHelpers.CacheTagHelper

Fields

CacheKeyPrefix()

Prefix used by [Microsoft.AspNet.Mvc.TagHelpers.CacheTagHelper](Microsoft.AspNet.Mvc.TagHelpers.CacheTagHelper.yml) instances when creating entries in [Microsoft.AspNet.Mvc.TagHelpers.CacheTagHelper.MemoryCache](Microsoft.AspNet.Mvc.TagHelpers.CacheTagHelper.yml).

public static readonly string CacheKeyPrefix

Constructors

CacheTagHelper(IMemoryCache)

Creates a new [Microsoft.AspNet.Mvc.TagHelpers.CacheTagHelper](Microsoft.AspNet.Mvc.TagHelpers.CacheTagHelper.yml).

Arguments:
  • memoryCache (IMemoryCache) – The @!:IMemoryCache-.
public CacheTagHelper(IMemoryCache memoryCache)

Properties

Enabled()

Gets or sets the value which determines if the tag helper is enabled or not.

Return type:System.Boolean
public bool Enabled { get; set; }
ExpiresAfter()

Gets or sets the duration, from the time the cache entry was added, when it should be evicted.

Return type:System.Nullable{System.TimeSpan}
public TimeSpan? ExpiresAfter { get; set; }
ExpiresOn()

Gets or sets the exact [System.DateTimeOffset]() the cache entry should be evicted.

Return type:System.Nullable{System.DateTimeOffset}
public DateTimeOffset? ExpiresOn { get; set; }
ExpiresSliding()

Gets or sets the duration from last access that the cache entry should be evicted.

Return type:System.Nullable{System.TimeSpan}
public TimeSpan? ExpiresSliding { get; set; }
MemoryCache()

Gets the @!:IMemoryCache- instance used to cache entries.

Return type:IMemoryCache
protected IMemoryCache MemoryCache { get; }
Priority()

Gets or sets the @!:CacheItemPriority- policy for the cache entry.

Return type:System.Nullable{CacheItemPriority}
public CacheItemPriority? Priority { get; set; }
VaryBy()

Gets or sets a [System.String]() to vary the cached result by.

Return type:System.String
public string VaryBy { get; set; }
VaryByCookie()

Gets or sets a comma-delimited set of cookie names to vary the cached result by.

Return type:System.String
public string VaryByCookie { get; set; }
VaryByHeader()

Gets or sets the name of a HTTP request header to vary the cached result by.

Return type:System.String
public string VaryByHeader { get; set; }
VaryByQuery()

Gets or sets a comma-delimited set of query parameters to vary the cached result by.

Return type:System.String
public string VaryByQuery { get; set; }
VaryByRoute()

Gets or sets a comma-delimited set of route data parameters to vary the cached result by.

Return type:System.String
public string VaryByRoute { get; set; }
VaryByUser()

Gets or sets a value that determines if the cached result is to be varied by the Identity for the logged in @!:HttpContext.User-.

Return type:System.Boolean
public bool VaryByUser { get; set; }
ViewContext()

Gets or sets the [Microsoft.AspNet.Mvc.TagHelpers.CacheTagHelper.ViewContext](Microsoft.AspNet.Mvc.TagHelpers.CacheTagHelper.yml) for the current executing View.

Return type:Microsoft.AspNet.Mvc.ViewContext
public ViewContext ViewContext { get; set; }

Methods

ProcessAsync(TagHelperContext, TagHelperOutput)
Arguments:
  • context (TagHelperContext) –
  • output (TagHelperOutput) –
Return type:

System.Threading.Tasks.Task

public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)