Provides a wrapper for IConnectionMultiplexer which is able to do a force reconnect when StackExchange.Redis fails to reconnect by using the logic from LazyReconnect.
Nuget package:
var configuration = "127.0.0.1";
var multiplexer = new ResilientConnectionMultiplexer(() => ConnectionMultiplexer.Connect(configuration));
var multiplexer2 = new ResilientConnectionMultiplexer(
() => ConnectionMultiplexer.Connect(configuration),
new ResilientConnectionConfiguration
{
ReconnectMinFrequency = TimeSpan.FromSeconds(60),
ReconnectErrorThreshold = TimeSpan.FromSeconds(30)
});
var multiplexer3 = new ResilientConnectionMultiplexer(
() => ConnectionMultiplexer.Connect(configuration),
() => ConnectionMultiplexer.ConnectAsync(configuration));IBatchmethods may throw anObjectDisposedExceptionwhen a reconnect was done after the batch was created.ITransactionmethods may throw anObjectDisposedExceptionwhen a reconnect was done after the transaction was created.- Enumerating a collection from
IDatabase.SetScan,IDatabase.HashScanandIDatabase.SortedSetScanmethods may throw anObjectDisposedExceptionwhen a reconnect was done while iterating the collection.