Open bragma opened 4 years ago
We won't expose the ConnectionMultiplexer
in DI. We don't put types we don't control into the DI container because it can mess with a lot of different DI services.
What we could do instead is offer a Func<ConnectionMutiplexer>
"factory" option on the RedisCacheOptions. Then you could specify your own connection and share it with other components.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Is your feature request related to a problem? Please describe.
I'm trying to use our Redis server from an ASP .NET Core Web Api via the IDistributedCache interface. While this is OK, I'd also like to be able to use other data types/access modes from Redis via direct commands, i.e. I'd like to be able to use the IDatabase private member directly, preserving the IDistributedCache interface.
Describe the solution you'd like
Some way to be able to use the same IDatabase _cached property directly or at least created a new one from a public Connect() method using the existing ConnectionMultiplexer object.
Describe alternatives you've considered
In setup.cs, creating a singleton object RedisCache and keep a reference to it, also passing it as a service singleton instance. This may cause problems with the Connect() lock, though.
Thanks!