Table of Contents

Class ContextualTtl

Namespace
Polly.Caching
Assembly
Polly.dll

Defines a ttl strategy which will cache items for a TimeSpan which may be influenced by data in the execution context.

public class ContextualTtl : ITtlStrategy
Inheritance
ContextualTtl
Implements
Inherited Members

Constructors

ContextualTtl()

public ContextualTtl()

Fields

SlidingExpirationKey

The key on the execution Context to use for storing whether the Ttl should be treated as sliding expiration. If no value is provided for this key, a ttl will not be treated as sliding expiration.

public static readonly string SlidingExpirationKey

Field Value

string

TimeSpanKey

The key on the execution Context to use for storing the Ttl TimeSpan for which to cache.

public static readonly string TimeSpanKey

Field Value

string

Methods

GetTtl(Context)

Gets the TimeSpan for which to keep an item about to be cached, which may be influenced by data in the execution context.

public Ttl GetTtl(Context context)

Parameters

context Context

The execution context.

Returns

Ttl

TimeSpan.