ResponseExtensions.OutputCache Method

Definition

Configures the cache policy of an HTTP response instance.

public static void OutputCache (this System.Web.HttpResponseBase response, int numberOfSeconds, bool sliding = false, System.Collections.Generic.IEnumerable<string> varyByParams = default, System.Collections.Generic.IEnumerable<string> varyByHeaders = default, System.Collections.Generic.IEnumerable<string> varyByContentEncodings = default, System.Web.HttpCacheability cacheability = 4);
static member OutputCache : System.Web.HttpResponseBase * int * bool * seq<string> * seq<string> * seq<string> * System.Web.HttpCacheability -> unit
<Extension()>
Public Sub OutputCache (response As HttpResponseBase, numberOfSeconds As Integer, Optional sliding As Boolean = false, Optional varyByParams As IEnumerable(Of String) = null, Optional varyByHeaders As IEnumerable(Of String) = null, Optional varyByContentEncodings As IEnumerable(Of String) = null, Optional cacheability As HttpCacheability = 4)

Parameters

response
HttpResponseBase

The HTTP response instance.

numberOfSeconds
Int32

The length of time, in seconds, before items expire from the cache.

sliding
Boolean

true to indicate that items expire from the cache on a sliding basis; false to indicate that items expire when they reach the predefined expiration time.

varyByParams
IEnumerable<String>

The list of all parameters that can be received by a GET or POST operation that affect caching.

varyByHeaders
IEnumerable<String>

The list of all HTTP headers that affect caching.

varyByContentEncodings
IEnumerable<String>

The list of all Content-Encoding headers that affect caching.

cacheability
HttpCacheability

One of the enumeration values that specifies how items are cached.

Applies to