BB.Caching.SharedCache.GetReadConnections C# (CSharp) Method

GetReadConnections() public method

Gets read-only connections for each of the keys supplied.
public GetReadConnections ( RedisKey keys ) : RedisKey[]>.Dictionary
keys RedisKey /// The keys to get read connections for. ///
return RedisKey[]>.Dictionary
        public Dictionary<ConnectionMultiplexer, RedisKey[]> GetReadConnections(RedisKey[] keys)
        {
            var result = new Dictionary<ConnectionGroup, List<RedisKey>>();
            foreach (RedisKey key in keys)
            {
                var connection = this._consistentHashRing.GetNode(key);
                if (!result.ContainsKey(connection))
                {
                    result[connection] = new List<RedisKey> { key };
                }
                else
                {
                    result[connection].Add(key);
                }
            }

            return result.ToDictionary(r => r.Key.GetReadMultiplexer(), r => r.Value.ToArray());
        }