Description
Currently the RedisCache
creates the ConnectionMultiplexer
and does not allow access to it. This prevents the application from reusing the ConnectionMultiplexer
for other operations like PubSub.
Granted, the application could create another ConnectionMultiplexer
, but the recommendation is to have only one per application.
I was thinking if it would be possible to have a separate constructor for RedisCache
that would receive the ConnectionMultiplexer
. I understand that so far Microsoft.Extensions.Caching.Redis did not leak any implementation details about its usage of StackExchange.Redis. However, I noticed that Microsoft.AspNetCore.DataProtection.Redis leaks StackExchange.Redis types here. So, I'm unclear about how you feel about keeping StackExchange.Redis as an implementation detail.
Proposed API
namespace Microsoft.Extensions.Caching.StackExchangeRedis
{
public class RedisCacheOptions
{
+ Func<IConnectionMultiplexer> ConnectionMultiplexerFactory { get; set; }
}