Note

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

Access to this page requires authorization. You can try .

OutputCachePolicyBuilder.VaryByValue Method

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

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.

Overloads

Name Description
VaryByValue(Func<HttpContext,KeyValuePair<String,String>>)

Adds a policy to vary the cached responses by custom key/value.

VaryByValue(Func<HttpContext,CancellationToken,ValueTask<KeyValuePair<String,String>>>)

Adds a policy that vary the cached content based on the specified value.

VaryByValue(String, String)

Adds a policy to vary the cached responses by custom key/value.

VaryByValue(Func<HttpContext,KeyValuePair<String,String>>)

Source:
OutputCachePolicyBuilder.cs

Adds a policy to vary the cached responses by custom key/value.

public Microsoft.AspNetCore.OutputCaching.OutputCachePolicyBuilder VaryByValue(Func<Microsoft.AspNetCore.Http.HttpContext,System.Collections.Generic.KeyValuePair<string,string>> varyBy);
member this.VaryByValue : Func<Microsoft.AspNetCore.Http.HttpContext, System.Collections.Generic.KeyValuePair<string, string>> -> Microsoft.AspNetCore.OutputCaching.OutputCachePolicyBuilder
Public Function VaryByValue (varyBy As Func(Of HttpContext, KeyValuePair(Of String, String))) As OutputCachePolicyBuilder

Parameters

varyBy
Func<HttpContext,KeyValuePair<String,String>>

The key/value to vary the cached responses by.

Returns

Applies to

VaryByValue(Func<HttpContext,CancellationToken,ValueTask<KeyValuePair<String,String>>>)

Source:
OutputCachePolicyBuilder.cs

Adds a policy that vary the cached content based on the specified value.

public Microsoft.AspNetCore.OutputCaching.OutputCachePolicyBuilder VaryByValue(Func<Microsoft.AspNetCore.Http.HttpContext,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<System.Collections.Generic.KeyValuePair<string,string>>> varyBy);
member this.VaryByValue : Func<Microsoft.AspNetCore.Http.HttpContext, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<System.Collections.Generic.KeyValuePair<string, string>>> -> Microsoft.AspNetCore.OutputCaching.OutputCachePolicyBuilder
Public Function VaryByValue (varyBy As Func(Of HttpContext, CancellationToken, ValueTask(Of KeyValuePair(Of String, String)))) As OutputCachePolicyBuilder

Parameters

varyBy
Func<HttpContext,CancellationToken,ValueTask<KeyValuePair<String,String>>>

The key/value to vary the cached responses by.

Returns

Applies to

VaryByValue(String, String)

Source:
OutputCachePolicyBuilder.cs

Adds a policy to vary the cached responses by custom key/value.

public Microsoft.AspNetCore.OutputCaching.OutputCachePolicyBuilder VaryByValue(string key, string value);
member this.VaryByValue : string * string -> Microsoft.AspNetCore.OutputCaching.OutputCachePolicyBuilder
Public Function VaryByValue (key As String, value As String) As OutputCachePolicyBuilder

Parameters

key
String

The key to vary the cached responses by.

value
String

The value to vary the cached responses by.

Returns

Applies to


Feedback

Was this page helpful?