Sha256: 9c98e9cf0ade0d18ff5f23994714a814f91bf0042c9e2dda2e9758a3e60621d1

Contents?: true

Size: 641 Bytes

Versions: 18

Compression:

Stored size: 641 Bytes

Contents

# frozen_string_literal: true

class Redis
  class Cluster
    # Node key's format is `<ip>:<port>`.
    # It is different from node id.
    # Node id is internal identifying code in Redis Cluster.
    module NodeKey
      DELIMITER = ':'

      module_function

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

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

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

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

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/redis-4.8.1/lib/redis/cluster/node_key.rb
redis-4.8.1 lib/redis/cluster/node_key.rb
redis-4.8.0 lib/redis/cluster/node_key.rb
redis-4.7.1 lib/redis/cluster/node_key.rb
redis-4.7.0 lib/redis/cluster/node_key.rb
redis-4.6.0 lib/redis/cluster/node_key.rb
redis-4.5.1 lib/redis/cluster/node_key.rb
redis-4.5.0 lib/redis/cluster/node_key.rb
redis-4.4.0 lib/redis/cluster/node_key.rb
redis-4.3.1 lib/redis/cluster/node_key.rb
redis-4.3.0 lib/redis/cluster/node_key.rb
redis-4.2.5 lib/redis/cluster/node_key.rb
redis-4.2.4 lib/redis/cluster/node_key.rb
redis-4.2.3 lib/redis/cluster/node_key.rb
redis-4.2.2 lib/redis/cluster/node_key.rb
redis-4.2.1 lib/redis/cluster/node_key.rb
redis-4.2.0 lib/redis/cluster/node_key.rb
redis-4.1.4 lib/redis/cluster/node_key.rb