Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reuse of a Redis ConnectionMultiplexer instance between RedisCache and RedisBackplane #177

Merged
merged 1 commit into from
Oct 14, 2023

Conversation

JeffreyM
Copy link
Contributor

@JeffreyM JeffreyM commented Oct 5, 2023

Added a factory method (ConnectionMultiplexerFactory) to RedisBackplaneOptions similar to that found in Microsoft.Extensions.Caching.Redis.RedisCacheOptions. This will allow for the shared use of a ConnectionMultiplexer between a RedisCache and RedisBackplane.

var options = ConfigurationOptions.Parse("REDIS_CONNECTION_STRING");
var multiplexer = ConnectionMultiplexer.Connect(options);

var redisCache = new RedisCache(new RedisCacheOptions() { 
    ConnectionMultiplexerFactory = async () => await Task.FromResult((IConnectionMultiplexer)multiplexer).ConfigureAwait(false) });

var redisBackplane = new RedisBackplane(new RedisBackplaneOptions() { 
    ConnectionMultiplexerFactory = async () => await Task.FromResult((IConnectionMultiplexer)multiplexer).ConfigureAwait(false) });

builder.Services.AddFusionCache()
    .WithDistributedCache(redisCache)
    .WithBackplane(redisBackplane);

…neOptions to allow passing a ConnectionMultiplexer instance.
@jodydonetti
Copy link
Collaborator

Hi @JeffreyM and thanks for using FusionCache!

This is a good idea, and something I was thinking about for some time but never had time to sit down and do it.
Right now I'm at the finish line of a very big new version, so I'll merge this soon and if needed will fix the potential conflicts that may emerge.

Will update you soon, thanks!

@JeffreyM
Copy link
Contributor Author

JeffreyM commented Oct 10, 2023

Thank you @jodydonetti. Good luck with the next release and thank you for taking the time to create and maintain FusionCache. It's an extremely capable and approachable library and, bonus, has the best documentation of any FOSS project I've run across.

Hat tip to you!

@jodydonetti
Copy link
Collaborator

jodydonetti commented Oct 11, 2023

Thank you @jodydonetti. Good luck with the next release and thank you for taking the time to create and maintain FusionCache.

Thanks, I'm glad you're finding it useful!

It's an extremely capable and approachable library and, bonus, has the best documentation of any FOSS project I've run across.

Hat tip to you!

Wow, thanks for your words, they really mean a lot 😊

Copy link
Collaborator

@jodydonetti jodydonetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jodydonetti jodydonetti merged commit eaa8e09 into ZiggyCreatures:main Oct 14, 2023
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants