ResponseCacheAttribute Class

Summary

Specifies the parameters necessary for setting appropriate headers in response caching.

Syntax

public class ResponseCacheAttribute : Attribute, _Attribute, IFilterFactory, IOrderedFilter, IFilter

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.ResponseCacheAttribute

Properties

CacheProfileName()

Gets or sets the value of the cache profile name.

Return type:System.String
public string CacheProfileName { get; set; }
Duration()

Gets or sets the duration in seconds for which the response is cached. This sets “max-age” in “Cache-control” header.

Return type:System.Int32
public int Duration { get; set; }
Location()

Gets or sets the location where the data from a particular URL must be cached.

Return type:Microsoft.AspNet.Mvc.ResponseCacheLocation
public ResponseCacheLocation Location { get; set; }
NoStore()

Gets or sets the value which determines whether the data should be stored or not. When set to <see langword=”true” />, it sets “Cache-control” header to “no-store”. Ignores the “Location” parameter for values other than “None”. Ignores the “duration” parameter.

Return type:System.Boolean
public bool NoStore { get; set; }
Order()

The order of the filter.

Return type:System.Int32
public int Order { get; set; }
VaryByHeader()

Gets or sets the value for the Vary response header.

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

Methods

CreateInstance(System.IServiceProvider)
Arguments:
  • serviceProvider (System.IServiceProvider) –
Return type:

Microsoft.AspNet.Mvc.IFilter

public IFilter CreateInstance(IServiceProvider serviceProvider)