Note

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

Access to this page requires authorization. You can try .

OutputCacheAttribute Class

Definition

Namespace:
Microsoft.AspNetCore.OutputCaching
Assembly:
Microsoft.AspNetCore.OutputCaching.dll
Package:
Microsoft.AspNetCore.App.Ref v10.0.0
Package:
Microsoft.AspNetCore.App.Ref v11.0.0-preview.4.26230.115
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:
OutputCacheAttribute.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 output caching.

[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public sealed class OutputCacheAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type OutputCacheAttribute = class
 inherit Attribute
Public NotInheritable Class OutputCacheAttribute
Inherits Attribute
Inheritance
OutputCacheAttribute
Attributes

Remarks

This attribute requires the output cache middleware.

Constructors

Name Description
OutputCacheAttribute()

Properties

Name Description
Duration

Gets or sets the duration in seconds for which the response is cached.

NoStore

Gets or sets the value which determines whether the response should be cached or not. When set to true, the response won't be cached.

PolicyName

Gets or sets the value of the cache policy name.

Tags

Gets or sets tags to apply to the output cache.

VaryByHeaderNames

Gets or sets the header names to vary by.

VaryByQueryKeys

Gets or sets the query keys to vary by.

VaryByRouteValueNames

Gets or sets the route value names to vary by.

Applies to


Feedback

Was this page helpful?