extensions
extensions copied to clipboard
[API Proposal]: Register multiple HybridCache objects
Background and motivation
EXPECTED We would like to manually register multiple HybridCaches and have control on how to resolve the IDistributedCache
GOAL We use different keyed singleton IDistributedCache objects in our code We want to have as many HybridCaches as IDistributedCache implementations
API Proposal
services.AddSingleton(x =>
{
var options = new HybridCacheOptions
{
DistributedCache = sp.GetRequiredService<MyFirstDistributedCache>());
};
return new MyFirstHybridCache(options);
});
services.AddSingleton(x =>
{
var options = new HybridCacheOptions
{
DistributedCache = sp.GetRequiredService<MySecondDistributedCache>());
};
return new MySecondHybridCache(options);
});
API Usage
.
Alternative Designs
No response
Risks
No response