|
|
@@ -257,14 +257,7 @@ public partial class RedisCache : IDistributedCache, IDisposable
|
|
|
IConnectionMultiplexer connection;
|
|
|
if (_options.ConnectionMultiplexerFactory is null)
|
|
|
{
|
|
|
- if (_options.ConfigurationOptions is not null)
|
|
|
- {
|
|
|
- connection = ConnectionMultiplexer.Connect(_options.ConfigurationOptions);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- connection = ConnectionMultiplexer.Connect(_options.Configuration!);
|
|
|
- }
|
|
|
+ connection = ConnectionMultiplexer.Connect(_options.GetConfiguredOptions());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -308,7 +301,7 @@ public partial class RedisCache : IDistributedCache, IDisposable
|
|
|
IConnectionMultiplexer connection;
|
|
|
if (_options.ConnectionMultiplexerFactory is null)
|
|
|
{
|
|
|
- connection = await ConnectionMultiplexer.ConnectAsync(_options.GetConfiguredOptions("asp.net DC")).ConfigureAwait(false);
|
|
|
+ connection = await ConnectionMultiplexer.ConnectAsync(_options.GetConfiguredOptions()).ConfigureAwait(false);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -332,6 +325,7 @@ public partial class RedisCache : IDistributedCache, IDisposable
|
|
|
WriteTimeTicks(ref _lastConnectTicks, DateTimeOffset.UtcNow);
|
|
|
ValidateServerFeatures(connection);
|
|
|
TryRegisterProfiler(connection);
|
|
|
+ TryAddSuffix(connection);
|
|
|
}
|
|
|
|
|
|
private void ValidateServerFeatures(IConnectionMultiplexer connection)
|
|
|
@@ -369,6 +363,19 @@ public partial class RedisCache : IDistributedCache, IDisposable
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void TryAddSuffix(IConnectionMultiplexer connection)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ connection.AddLibraryNameSuffix("aspnet");
|
|
|
+ connection.AddLibraryNameSuffix("DC");
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Log.UnableToAddLibraryNameSuffix(_logger, ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private byte[]? GetAndRefresh(string key, bool getData)
|
|
|
{
|
|
|
ArgumentNullThrowHelper.ThrowIfNull(key);
|