Class CacheBehaviorOptions
Expiration, timeout, and behavior configuration for cache operations.
public sealed class CacheBehaviorOptions
- Inheritance
-
CacheBehaviorOptions
- Inherited Members
- Extension Methods
Properties
CacheTimeout
Gets or sets the maximum time to wait for a single distributed (L2) cache backend call before the call is abandoned. Default is 200 milliseconds.
public TimeSpan CacheTimeout { get; set; }
Property Value
- TimeSpan
The maximum time to wait for one distributed cache backend call.
Remarks
This bounds backend I/O only. It does not bound handler execution: a cached operation runs the handler, and a handler is expected to take as long as its work takes. A cache whose deadline could expire while the handler runs would abandon the shared in-flight operation that collapses concurrent callers into one execution, so a slow handler would lose stampede protection precisely where it is most valuable.
An exceeded deadline is not an error. A read that runs long is reported as a miss and the handler executes; a write that runs long is dropped and the next request re-populates the entry. Neither fails the operation being cached.
DefaultExpiration
Gets or sets the default expiration time for cached items. Default is 10 minutes.
public TimeSpan DefaultExpiration { get; set; }
Property Value
- TimeSpan
The default expiration time for cached items.
EnableStatistics
Gets or sets a value indicating whether to enable cache statistics collection.
public bool EnableStatistics { get; set; }
Property Value
JitterRatio
Gets or sets the ratio of random jitter applied to cache TTLs. Default is 0.10 (10%).
[Range(0, 1)]
public double JitterRatio { get; set; }
Property Value
- double
The jitter ratio applied to cache TTLs.