Class CacheOptions
Configuration options for the Dispatch caching system. Supports memory, distributed, and hybrid caching modes.
public sealed class CacheOptions
- Inheritance
-
CacheOptions
- Inherited Members
- Extension Methods
Properties
Behavior
Gets or sets expiration and behavior configuration for cache operations.
public CacheBehaviorOptions Behavior { get; set; }
Property Value
- CacheBehaviorOptions
Expiration and behavior configuration for cache operations.
CacheKeyBuilder
Gets or sets the cache key builder used to generate cache keys. If not specified, DefaultCacheKeyBuilder is used.
public ICacheKeyBuilder? CacheKeyBuilder { get; set; }
Property Value
- ICacheKeyBuilder
The cache key builder used to generate cache keys.
CacheMode
Gets or sets the caching mode to use. Determines whether to use memory, distributed, or hybrid caching.
public CacheMode CacheMode { get; set; }
Property Value
- CacheMode
The caching mode to use.
DefaultTags
Gets or sets the default tags to apply to all cached items. Tags enable bulk invalidation of related cache entries.
public string[] DefaultTags { get; set; }
Property Value
- string[]
The default tags to apply to all cached items.
Distributed
Gets or sets distributed cache specific options. Only used when CacheMode is Distributed or Hybrid.
public DistributedCacheOptions Distributed { get; set; }
Property Value
- DistributedCacheOptions
Distributed cache specific options.
Enabled
Gets or sets a value indicating whether caching is enabled. Default is false, must be explicitly enabled.
public bool Enabled { get; set; }
Property Value
GlobalPolicy
Gets or sets the global cache policy to apply to all cacheable operations. Can be overridden per operation.
public IResultCachePolicy? GlobalPolicy { get; set; }
Property Value
- IResultCachePolicy
The global cache policy to apply to all cacheable operations.
Resilience
Gets or sets resilience configuration for cache operations including circuit breaker settings.
public CacheResilienceOptions Resilience { get; set; }
Property Value
- CacheResilienceOptions
Resilience configuration for cache operations.
TagStampLifetime
Gets or sets how long a tag's version stamp record is retained in the distributed cache backend. Default is 1000 days. Must be strictly greater than DefaultExpiration so that a cache entry can never outlive the tag stamp record it was written against.
public TimeSpan TagStampLifetime { get; set; }
Property Value
- TimeSpan
The retention period for a tag's version stamp record.
TagStampRefreshInterval
Gets or sets how long a resolved tag version stamp is trusted before a tag tracker re-checks its backend for a newer one. Default is 5 seconds. Refresh happens on demand; backend latency, failures and overlapping operations prevent a strict cross-instance visibility deadline.
public TimeSpan TagStampRefreshInterval { get; set; }
Property Value
- TimeSpan
The refresh interval for a tag tracker's per-tag version stamp memo.
TagTrackerCapacity
Gets or sets the maximum number of distinct tags retained locally by a tag tracker. Default is 10,000.
public int TagTrackerCapacity { get; set; }
Property Value
- int
The maximum number of tracked tag version stamps.
Remarks
The distributed tracker bypasses local memoization for new tags at capacity, increasing backend reads without deleting backend stamps or changing their lifetime. The in-memory tracker uses its global invalidation fallback at capacity. This bounds entry count, not tag-string byte size or backend operations already in flight.
UseDistributedCache
Gets or sets a value indicating whether to use distributed cache. This is a convenience property that sets CacheMode to Distributed when true.
public bool UseDistributedCache { get; set; }