ResponseCacheAttribute ResponseCacheAttribute ResponseCacheAttribute ResponseCacheAttribute Class


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

public ref class ResponseCacheAttribute : Attribute, Microsoft::AspNetCore::Mvc::Filters::IFilterFactory, Microsoft::AspNetCore::Mvc::Filters::IOrderedFilter
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class ResponseCacheAttribute : Attribute, Microsoft.AspNetCore.Mvc.Filters.IFilterFactory, Microsoft.AspNetCore.Mvc.Filters.IOrderedFilter
type ResponseCacheAttribute = class
    inherit Attribute
    interface IFilterFactory
    interface IFilterMetadata
    interface IOrderedFilter
Public Class ResponseCacheAttribute
Inherits Attribute
Implements IFilterFactory, IOrderedFilter


ResponseCacheAttribute() ResponseCacheAttribute() ResponseCacheAttribute() ResponseCacheAttribute()


CacheProfileName CacheProfileName CacheProfileName CacheProfileName

Gets or sets the value of the cache profile name.

Duration Duration Duration Duration

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

IsReusable IsReusable IsReusable IsReusable
Location Location Location Location

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

NoStore NoStore NoStore NoStore

Gets or sets the value which determines whether the data should be stored or not. When set to true, it sets "Cache-control" header to "no-store". Ignores the "Location" parameter for values other than "None". Ignores the "duration" parameter.

Order Order Order Order
VaryByHeader VaryByHeader VaryByHeader VaryByHeader

Gets or sets the value for the Vary response header.

VaryByQueryKeys VaryByQueryKeys VaryByQueryKeys VaryByQueryKeys

Gets or sets the query keys to vary by.


CreateInstance(IServiceProvider) CreateInstance(IServiceProvider) CreateInstance(IServiceProvider) CreateInstance(IServiceProvider)
GetCacheProfile(MvcOptions) GetCacheProfile(MvcOptions) GetCacheProfile(MvcOptions) GetCacheProfile(MvcOptions)

Gets the CacheProfile for this attribute.

Applies to