We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在ClusterAdapter的构造函数中,我认为可以将如下代码
public ClusterAdapter(RedisClient topOwner, ConnectionStringBuilder[] clusterConnectionStrings, Dictionary<string, string> hostMappings) { UseType = UseType.Cluster; TopOwner = topOwner; if (clusterConnectionStrings.Any() != true) throw new ArgumentNullException(nameof(clusterConnectionStrings)); _clusterConnectionStrings = clusterConnectionStrings.ToArray(); // 这里进行了循环Copy if (hostMappings != null) { // 这里构造了一个新的字典实例 _hostMappings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); foreach (var kv in hostMappings) _hostMappings.Add(kv.Key, kv.Value); } // Copy完后又对Copy过程中生成了新的字典实例进行丢弃。 _hostMappings = hostMappings; _baseEncoding = _clusterConnectionStrings.FirstOrDefault()?.Encoding; _ib = new IdleBus<RedisClientPool>(TimeSpan.FromMinutes(10)); RefershClusterNodes(); }
更改为
public ClusterAdapter(RedisClient topOwner, ConnectionStringBuilder[] clusterConnectionStrings, Dictionary<string, string> hostMappings) { UseType = UseType.Cluster; TopOwner = topOwner; if (clusterConnectionStrings.Any() != true) throw new ArgumentNullException(nameof(clusterConnectionStrings)); _clusterConnectionStrings = clusterConnectionStrings.ToArray(); _hostMappings = hostMappings; _baseEncoding = _clusterConnectionStrings.FirstOrDefault()?.Encoding; _ib = new IdleBus<RedisClientPool>(TimeSpan.FromMinutes(10)); RefershClusterNodes(); }
The text was updated successfully, but these errors were encountered:
因为不确定是否会被外部引用修改,所以这样写是最安全。
Sorry, something went wrong.
No branches or pull requests
在ClusterAdapter的构造函数中,我认为可以将如下代码
更改为
The text was updated successfully, but these errors were encountered: