CacheProfile Class

Defines a set of settings which can be used for response caching.

Namespace
Microsoft.AspNetCore.Mvc
Assemblies
  • Microsoft.AspNetCore.Mvc.Core

Syntax

public class CacheProfile
class Microsoft.AspNetCore.Mvc.CacheProfile

Properties

Microsoft.AspNetCore.Mvc.CacheProfile.Duration

Gets or sets the duration in seconds for which the response is cached. If this property is set to a non null value, the “max-age” in “Cache-control” header is set in the Microsoft.AspNetCore.Http.HttpContext.Response.

Return type:System.Nullable<System.Int32>
public int ? Duration { get; set; }
Microsoft.AspNetCore.Mvc.CacheProfile.Location

Gets or sets the location where the data from a particular URL must be cached. If this property is set to a non null value, the “Cache-control” header is set in the Microsoft.AspNetCore.Http.HttpContext.Response.

Return type:System.Nullable<Microsoft.AspNetCore.Mvc.ResponseCacheLocation>
public ResponseCacheLocation? Location { get; set; }
Microsoft.AspNetCore.Mvc.CacheProfile.NoStore

Gets or sets the value which determines whether the data should be stored or not. When set to <xref uid=”langword_csharp_true” name=”true” href=”“></xref>, it sets “Cache-control” header in Microsoft.AspNetCore.Http.HttpContext.Response to “no-store”. Ignores the “Location” parameter for values other than “None”. Ignores the “Duration” parameter.

Return type:System.Nullable<System.Boolean>
public bool ? NoStore { get; set; }
Microsoft.AspNetCore.Mvc.CacheProfile.VaryByHeader

Gets or sets the value for the Vary header in Microsoft.AspNetCore.Http.HttpContext.Response.

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