Class: Dalli::ElastiCache
- Inherits:
-
Object
- Object
- Dalli::ElastiCache
- Defined in:
- lib/dalli/elasticache.rb,
lib/dalli/elasticache/version.rb
Constant Summary collapse
- VERSION =
"0.1.2"
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#client ⇒ Object
Dalli::Client configured to connect to the cluster’s nodes.
-
#engine_version ⇒ Object
The cache engine version of the cluster.
-
#initialize(config_endpoint, options = {}) ⇒ ElastiCache
constructor
A new instance of ElastiCache.
-
#refresh ⇒ Object
Clear all cached data from the cluster endpoint.
-
#servers ⇒ Object
List of cluster server nodes with ip addresses and ports.
-
#version ⇒ Object
The number of times the cluster configuration has been changed.
Constructor Details
#initialize(config_endpoint, options = {}) ⇒ ElastiCache
Returns a new instance of ElastiCache.
12 13 14 15 |
# File 'lib/dalli/elasticache.rb', line 12 def initialize(config_endpoint, ={}) @endpoint = Dalli::Elasticache::AutoDiscovery::Endpoint.new(config_endpoint) @options = end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
10 11 12 |
# File 'lib/dalli/elasticache.rb', line 10 def endpoint @endpoint end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/dalli/elasticache.rb', line 10 def @options end |
Instance Method Details
#client ⇒ Object
Dalli::Client configured to connect to the cluster’s nodes
18 19 20 |
# File 'lib/dalli/elasticache.rb', line 18 def client Dalli::Client.new(servers, ) end |
#engine_version ⇒ Object
The cache engine version of the cluster
30 31 32 |
# File 'lib/dalli/elasticache.rb', line 30 def engine_version endpoint.engine_version end |
#refresh ⇒ Object
Clear all cached data from the cluster endpoint
40 41 42 43 44 45 |
# File 'lib/dalli/elasticache.rb', line 40 def refresh config_endpoint = "#{endpoint.host}:#{endpoint.port}" @endpoint = Dalli::Elasticache::AutoDiscovery::Endpoint.new(config_endpoint) self end |
#servers ⇒ Object
List of cluster server nodes with ip addresses and ports
35 36 37 |
# File 'lib/dalli/elasticache.rb', line 35 def servers endpoint.config.nodes.map{ |h| "#{h[:ip]}:#{h[:port]}" } end |
#version ⇒ Object
The number of times the cluster configuration has been changed
Returns an integer
25 26 27 |
# File 'lib/dalli/elasticache.rb', line 25 def version endpoint.config.version end |