Module: Redis::Cluster::NodeKey

Defined in:
lib/redis/cluster/node_key.rb

Overview

Node key’s format is ‘<ip>:<port>`. It is different from node id. Node id is internal identifying code in Redis Cluster.

Constant Summary collapse

DELIMITER =
':'

Class Method Summary collapse

Class Method Details

.build_from_host_port(host, port) ⇒ Object



26
27
28
# File 'lib/redis/cluster/node_key.rb', line 26

def build_from_host_port(host, port)
  "#{host}#{DELIMITER}#{port}"
end

.build_from_uri(uri) ⇒ Object



22
23
24
# File 'lib/redis/cluster/node_key.rb', line 22

def build_from_uri(uri)
  "#{uri.host}#{DELIMITER}#{uri.port}"
end

.optionize(node_key) ⇒ Object



13
14
15
16
# File 'lib/redis/cluster/node_key.rb', line 13

def optionize(node_key)
  host, port = split(node_key)
  { host: host, port: port }
end

.split(node_key) ⇒ Object



18
19
20
# File 'lib/redis/cluster/node_key.rb', line 18

def split(node_key)
  node_key.split(DELIMITER)
end