ResponseCacheFilter ResponseCacheFilter ResponseCacheFilter Class


An IActionFilter which sets the appropriate headers related to response caching.

public class ResponseCacheFilter : Microsoft.AspNetCore.Mvc.Filters.IActionFilter, Microsoft.AspNetCore.Mvc.Internal.IResponseCacheFilter
type ResponseCacheFilter = class
    interface IActionFilter
    interface IFilterMetadata
    interface IResponseCacheFilter
Public Class ResponseCacheFilter
Implements IActionFilter, IResponseCacheFilter


ResponseCacheFilter(CacheProfile) ResponseCacheFilter(CacheProfile) ResponseCacheFilter(CacheProfile)

Creates a new instance of ResponseCacheFilter

ResponseCacheFilter(CacheProfile, ILoggerFactory) ResponseCacheFilter(CacheProfile, ILoggerFactory) ResponseCacheFilter(CacheProfile, ILoggerFactory)

Creates a new instance of ResponseCacheFilter


Duration Duration Duration

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

Location Location Location

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

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.

VaryByHeader VaryByHeader VaryByHeader

Gets or sets the value for the Vary response header.

VaryByQueryKeys VaryByQueryKeys VaryByQueryKeys

Gets or sets the query keys to vary by.


OnActionExecuted(ActionExecutedContext) OnActionExecuted(ActionExecutedContext) OnActionExecuted(ActionExecutedContext)
OnActionExecuting(ActionExecutingContext) OnActionExecuting(ActionExecutingContext) OnActionExecuting(ActionExecutingContext)

Applies to