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

Extension point for injecting custom instance of IConnectionMultiplexer #105

Open
footcha opened this issue Aug 10, 2018 · 1 comment
Open

Comments

@footcha
Copy link

footcha commented Aug 10, 2018

I would like to have full control of how an instance of StackExchange.IConnectionMultiplexer is created. Typically I have registered the multiplexer in IoC container in my application. I would like to reuse the process of creating the instance and to have more control over its lifecycle.

Suggested solution

New configuration parameter connectionMultiplexerFactoryType will contain type that implements IConnectionMultiplexerFactory:

public interface IConnectionMultiplexerFactory
{
    /// <summary>
    /// This method provides either new or already existing instance of <see cref="IConnectionMultiplexer"/>.
    /// </summary>
    /// <returns>Fully configured connection multiplexer</returns>
    IConnectionMultiplexer CreateMultiplexer();

    /// <summary>
    /// When <see cref="RedisSessionStateProvider"/> fails with <see cref="RedisConnectionException"/>
    /// then it sends to <see cref="IConnectionMultiplexerFactory"/> and attempt to cleanup a failed multiplexer.
    /// Additionally, the factory itself is responsible for providing a clean, fresh instance of IConnectionMultiplexer (it can be the same instance).
    /// </summary>
    /// <param name="connectionMultiplexer">Instance that failed with <see cref="RedisConnectionException"/></param>
    /// <returns>New or refreshed instance</returns>
    IConnectionMultiplexer RestartMultiplexer(IConnectionMultiplexer connectionMultiplexer);
}
@footcha footcha changed the title Extension point for injecting custom instance of IConnectionMultiplexer Extension point for injecting custom instance of IConnectionMultiplexer Aug 10, 2018
footcha added a commit to footcha/aspnet-redis-providers that referenced this issue Aug 10, 2018
…or handling custom lifecycle of StackEchange.IConnectionMultiplexer.
@ricardomomm
Copy link

Please, this is very important, specially as Azure Redis Cache uses the number of clients connected as base for subscription layers/prices.

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

No branches or pull requests

2 participants