-
Notifications
You must be signed in to change notification settings - Fork 115
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
♻ refactor(IDistributedCache): Optimize connections under Isolation and Attempt to reconnect #740
Conversation
|
||
namespace Masa.BuildingBlocks.Caching; | ||
|
||
internal class DistributedCacheClientCache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DistributedCacheClientCache的后缀Cache是OK的吗?你这是个工厂吧,改成ClientFactory?
{ | ||
public static ConcurrentDictionary<string, IManualDistributedCacheClient> CacheClients { get; set; } = new(); | ||
|
||
public IManualDistributedCacheClient GetCacheClient(IServiceProvider serviceProvider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IHttpClientFactory用的时CreateClient,要对其它吗?
...hing/Distributed/Masa.Contrib.Caching.Distributed.StackExchangeRedis/RedisCacheClientBase.cs
Outdated
Show resolved
Hide resolved
if (!_connection.IsConnected && !_connection.IsConnecting) | ||
{ | ||
return _connection.GetDatabase(); | ||
// Attempt to reconnect | ||
var redisConfiguration = _redisConfigurationOptions.GetAvailableRedisOptions(); | ||
_connection = ConnectionMultiplexer.Connect(redisConfiguration); | ||
Subscriber = _connection.GetSubscriber(); | ||
} | ||
|
||
// Attempt to reconnect | ||
var redisConfiguration = _redisConfigurationOptions.GetAvailableRedisOptions(); | ||
_connection = ConnectionMultiplexer.Connect(redisConfiguration); | ||
Subscriber = _connection.GetSubscriber(); | ||
|
||
if (_connection.IsConnected || _connection.IsConnecting) | ||
{ | ||
return _connection.GetDatabase(); | ||
} | ||
else | ||
if (!_connection.IsConnected && !_connection.IsConnecting) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这两个判断条件不是一样的吗?
Quality Gate passedIssues Measures |
No description provided.