class Dalli::Elasticache::AutoDiscovery::Endpoint

This is a representation of the configuration endpoint for a memcached cluster. It encapsulates information returned from that endpoint.

Constants

DEFAULT_PORT
ENDPOINT_REGEX

Matches Strings like “my-host.cache.aws.com:11211”

Attributes

host[R]

Endpoint configuration

port[R]

Endpoint configuration

Public Class Methods

new(addr) click to toggle source
# File lib/dalli/elasticache/auto_discovery/endpoint.rb, line 18
def initialize(addr)
  @host, @port = parse_endpoint_address(addr)
end

Public Instance Methods

config() click to toggle source

A cached ElastiCache::ConfigResponse

# File lib/dalli/elasticache/auto_discovery/endpoint.rb, line 36
def config
  @config ||= ConfigCommand.new(@host, @port, engine_version).response
end
engine_version() click to toggle source

The memcached engine version

# File lib/dalli/elasticache/auto_discovery/endpoint.rb, line 41
def engine_version
  stats.engine_version
end
parse_endpoint_address(addr) click to toggle source
# File lib/dalli/elasticache/auto_discovery/endpoint.rb, line 23
def parse_endpoint_address(addr)
  m = ENDPOINT_REGEX.match(addr)
  raise ArgumentError, "Unable to parse configuration endpoint address - #{addr}" unless m

  [m[1], (m[2] || DEFAULT_PORT).to_i]
end
stats() click to toggle source

A cached ElastiCache::StatsResponse

# File lib/dalli/elasticache/auto_discovery/endpoint.rb, line 31
def stats
  @stats ||= StatsCommand.new(@host, @port).response
end