Class: Dalli::ElastiCache
- Inherits:
-
Object
- Object
- Dalli::ElastiCache
- Defined in:
- lib/dalli/elasticache.rb,
lib/dalli/elasticache/version.rb
Constant Summary collapse
- VERSION =
"0.2.0"
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 Always use host name instead of private elasticache IPs as internal IPs can change after a node is rebooted.
-
#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 16 |
# File 'lib/dalli/elasticache.rb', line 12 def initialize(config_endpoint, ={}) cluster_timeout = ( || {}).delete(:cluster_timeout) || ( || {}).delete('cluster_timeout') @endpoint = Dalli::Elasticache::AutoDiscovery::Endpoint.new(config_endpoint, cluster_timeout) @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
19 20 21 |
# File 'lib/dalli/elasticache.rb', line 19 def client Dalli::Client.new(servers, ) end |
#engine_version ⇒ Object
The cache engine version of the cluster
31 32 33 |
# File 'lib/dalli/elasticache.rb', line 31 def engine_version endpoint.engine_version end |
#refresh ⇒ Object
Clear all cached data from the cluster endpoint
42 43 44 45 46 47 |
# File 'lib/dalli/elasticache.rb', line 42 def refresh config_endpoint = "#{endpoint.host}:#{endpoint.port}" @endpoint = Dalli::Elasticache::AutoDiscovery::Endpoint.new(config_endpoint, endpoint.timeout) self end |
#servers ⇒ Object
List of cluster server nodes with ip addresses and ports Always use host name instead of private elasticache IPs as internal IPs can change after a node is rebooted
37 38 39 |
# File 'lib/dalli/elasticache.rb', line 37 def servers endpoint.config.nodes.map{ |h| "#{h[:host]}:#{h[:port]}" } end |
#version ⇒ Object
The number of times the cluster configuration has been changed
Returns an integer
26 27 28 |
# File 'lib/dalli/elasticache.rb', line 26 def version endpoint.config.version end |