-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
enhancementNew feature or requestNew feature or requestfeatureThis label is in use for minor version incrementsThis label is in use for minor version increments
Milestone
Description
Title: Add IDistributedCache-based query caching behavior
Labels: enhancement, mediator
Body:
Problem
CachingQueryBehavior<TQuery, TResult> only supports IMemoryCache. In distributed systems (microservices, multi-instance deployments, Cortex.Streams scenarios), query results often need to be cached in Redis, SQL Server, or another distributed cache.
Proposed Solution
Create a Cortex.Mediator.Behaviors.DistributedCaching package (or add to core) with:
DistributedCachingQueryBehavior<TQuery, TResult>usingIDistributedCacheICacheSerializerinterface for pluggable serialization (default:System.Text.Json)- Support for the existing
ICacheableQueryand[Cacheable]attribute opt-in mechanisms DistributedCachingOptionsfor default TTL, serialization settings, key prefix
services.AddMediatorDistributedCaching(options =>
{
options.DefaultAbsoluteExpiration = TimeSpan.FromMinutes(10);
options.Serializer = new JsonCacheSerializer();
});Relationship to Existing Caching
This complements (not replaces) the existing IMemoryCache-based behavior. Users may use both (L1 in-memory + L2 distributed) via pipeline behavior ordering.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestfeatureThis label is in use for minor version incrementsThis label is in use for minor version increments