Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ResponseCacheAttribute Class

Definition

Namespace:
Microsoft.AspNetCore.Mvc
Assembly:
Microsoft.AspNetCore.Mvc.Core.dll
Package:
Microsoft.AspNetCore.Mvc.Core v1.0.0
Package:
Microsoft.AspNetCore.Mvc.Core v1.1.0
Package:
Microsoft.AspNetCore.App.Ref v10.0.0
Package:
Microsoft.AspNetCore.App.Ref v11.0.0-preview.4.26230.115
Package:
Microsoft.AspNetCore.Mvc.Core v2.0.0
Package:
Microsoft.AspNetCore.Mvc.Core v2.1.0
Package:
Microsoft.AspNetCore.Mvc.Core v2.2.0
Package:
Microsoft.AspNetCore.App.Ref v3.0.1
Package:
Microsoft.AspNetCore.App.Ref v3.1.10
Package:
Microsoft.AspNetCore.App.Ref v5.0.0
Package:
Microsoft.AspNetCore.App.Ref v6.0.36
Package:
Microsoft.AspNetCore.App.Ref v7.0.5
Package:
Microsoft.AspNetCore.App.Ref v8.0.19
Package:
Microsoft.AspNetCore.App.Ref v9.0.8
Source:
ResponseCacheAttribute.cs
Source:
ResponseCacheAttribute.cs
Source:
ResponseCacheAttribute.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type ResponseCacheAttribute = class
 inherit Attribute
 interface IFilterFactory
 interface IFilterMetadata
 interface IOrderedFilter
Public Class ResponseCacheAttribute
Inherits Attribute
Implements IFilterFactory, IOrderedFilter
Inheritance
ResponseCacheAttribute
Attributes
Implements

Constructors

Name Description
ResponseCacheAttribute()

Properties

Name Description
CacheProfileName

Gets or sets the value of the cache profile name.

Duration

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

IsReusable

Gets a value that indicates if the result of CreateInstance(IServiceProvider) can be reused across requests.

Location

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

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

Gets the order value for determining the order of execution of filters. Filters execute in ascending numeric value of the Order property.

VaryByHeader

Gets or sets the value for the Vary response header.

VaryByQueryKeys

Gets or sets the query keys to vary by.

Methods

Name Description
CreateInstance(IServiceProvider)

Creates an instance of the executable filter.

GetCacheProfile(MvcOptions)

Gets the CacheProfile for this attribute.

Applies to


Feedback

Was this page helpful?