Class ResponseCacheAttribute
Specifies the parameters necessary for setting appropriate headers in response caching.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public class ResponseCacheAttribute : Attribute, IActionFilter
- Inheritance
-
objectAttributeResponseCacheAttribute
- Implements
Properties
Duration
Gets or sets the duration in seconds for which the response is cached. This sets "max-age" in "Cache-control" header.
public int Duration { get; set; }
Property Value
Location
Gets or sets the location where the data from a particular URL must be cached.
public ResponseCacheLocation Location { get; set; }
Property Value
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.
public bool NoStore { get; set; }
Property Value
VaryByHeader
Gets or sets the value for the Vary response header.
public string? VaryByHeader { get; set; }
Property Value
VaryByQueryKeys
Gets or sets the query keys to vary by.
public string[]? VaryByQueryKeys { get; set; }
Property Value
- string[]
Remarks
VaryByQueryKeys requires the response cache middleware.
Methods
InvokeAsync(IActionFilterChain, IActionFilterContext)
public ValueTask<object?> InvokeAsync(IActionFilterChain chain, IActionFilterContext context)
Parameters
chain
IActionFilterChaincontext
IActionFilterContext
Returns
- ValueTask<object>