dotnet / dotnet/aspnetcore

Access the singleton ConnectionMultiplexer or have a new IDatabase while also using IDistributedCache interface

Open
#28,374 3 comments 0 reactions 0 assignees View on GitHub
area-middleware enhancement feature-caching
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### 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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.