Running ASP.NET Core 2.x and I'm trying to register two types of IDistributedCache services (both ship in the box).
I'd like to use the SQL Distributed Cache for Sessions and the local DistributedMemory cache for everything else (eventually this will be a redis cache, but that's irrelevant at the moment).
// Distributed Cache used for Sessions
services.AddDistributedSqlServerCache(o => // IDistributedCache with SQL backed storage version
{
o.ConnectionString = dbCs;
o.SchemaName = "dbo";
o.TableName = "Sessions";
});
services.AddDistributedMemoryCache();
As it stands, both of these resolve to IDistributedCache. Is it possible to direct the Sessions middleware to use the SQL cache and everything else to resolve to DistributedMemoryCache?