Skip to content

ICacheableQuery<TResult> interface

Namespace: Vitreous.Caching.Abstractions
Assembly: Vitreous.Caching.dll

Marks a query as cacheable. Implement this on any IQuery<TResult> to have its result automatically cached by CachingBehavior.

public interface ICacheableQuery<TResult> : IQuery<TResult>

TResult

The result type returned by the query.

IQuery<TResult>

How long the cached value lives. When set, takes precedence over SlidingExpiration. Null means no absolute expiry.

TimeSpan? AbsoluteExpiration { get; }

TimeSpan?

The unique cache key for this query instance. Should incorporate any parameters that affect the result, e.g. $“order:{Id}”.

string CacheKey { get; }

string

Sliding window expiration — the entry expires if not accessed within this window. The Redis backend applies it as a fixed TTL instead (use AbsoluteExpiration there). Null means no sliding expiry.

TimeSpan? SlidingExpiration { get; }

TimeSpan?

Optional tags attached to this cache entry. The base IDistributedCache backend ignores tags. The Redis backend uses them for tag-based bulk invalidation via IInvalidatesCache.

IReadOnlyList<string> Tags { get; }

IReadOnlyList<string>