Method: Redis::HashRing#initialize
- Defined in:
- lib/redis/hash_ring.rb
#initialize(nodes = [], replicas = POINTS_PER_SERVER) ⇒ HashRing
nodes is a list of objects that have a proper to_s representation. replicas indicates how many virtual points should be used pr. node, replicas are required to improve the distribution.
13 14 15 16 17 18 19 20 21 |
# File 'lib/redis/hash_ring.rb', line 13 def initialize(nodes=[], replicas=POINTS_PER_SERVER) @replicas = replicas @ring = {} @nodes = [] @sorted_keys = [] nodes.each do |node| add_node(node) end end |