Class: Dalli::Elasticache::AutoDiscovery::Endpoint
- Inherits:
-
Object
- Object
- Dalli::Elasticache::AutoDiscovery::Endpoint
- Defined in:
- lib/dalli/elasticache/auto_discovery/endpoint.rb
Defined Under Namespace
Classes: Timeout
Constant Summary collapse
- ENDPOINT_REGEX =
Matches Strings like “my-host.cache.aws.com:11211”
/([-.a-zA-Z0-9]+):(\d+)/
- STATS_COMMAND =
"stats\r\n"
- CONFIG_COMMAND =
"config get cluster\r\n"
- OLD_CONFIG_COMMAND =
Legacy command for version < 1.4.14
"get AmazonElastiCache:cluster\r\n"
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Endpoint configuration.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#config ⇒ Object
A cached ElastiCache::ConfigResponse.
-
#engine_version ⇒ Object
The memcached engine version.
-
#initialize(endpoint, timeout) ⇒ Endpoint
constructor
A new instance of Endpoint.
-
#stats ⇒ Object
A cached ElastiCache::StatsResponse.
Constructor Details
#initialize(endpoint, timeout) ⇒ Endpoint
Returns a new instance of Endpoint.
20 21 22 23 24 25 26 |
# File 'lib/dalli/elasticache/auto_discovery/endpoint.rb', line 20 def initialize(endpoint, timeout) ENDPOINT_REGEX.match(endpoint) do |m| @host = m[1] @port = m[2].to_i end @timeout = timeout end |
Instance Attribute Details
#host ⇒ Object (readonly)
Endpoint configuration
8 9 10 |
# File 'lib/dalli/elasticache/auto_discovery/endpoint.rb', line 8 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
9 10 11 |
# File 'lib/dalli/elasticache/auto_discovery/endpoint.rb', line 9 def port @port end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
10 11 12 |
# File 'lib/dalli/elasticache/auto_discovery/endpoint.rb', line 10 def timeout @timeout end |
Instance Method Details
#config ⇒ Object
A cached ElastiCache::ConfigResponse
34 35 36 |
# File 'lib/dalli/elasticache/auto_discovery/endpoint.rb', line 34 def config @config ||= get_config_from_remote end |
#engine_version ⇒ Object
The memcached engine version
39 40 41 |
# File 'lib/dalli/elasticache/auto_discovery/endpoint.rb', line 39 def engine_version stats.version end |
#stats ⇒ Object
A cached ElastiCache::StatsResponse
29 30 31 |
# File 'lib/dalli/elasticache/auto_discovery/endpoint.rb', line 29 def stats @stats ||= get_stats_from_remote end |