Class: Dalli::Elasticache::AutoDiscovery::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/dalli/elasticache/auto_discovery/node.rb

Overview

Represents a single memcached node in the cluster.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, ip, port) ⇒ Node

Returns a new instance of Node.



13
14
15
16
17
# File 'lib/dalli/elasticache/auto_discovery/node.rb', line 13

def initialize(host, ip, port)
  @host = host
  @ip = ip
  @port = port
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



11
12
13
# File 'lib/dalli/elasticache/auto_discovery/node.rb', line 11

def host
  @host
end

#ipObject (readonly)

Returns the value of attribute ip.



11
12
13
# File 'lib/dalli/elasticache/auto_discovery/node.rb', line 11

def ip
  @ip
end

#portObject (readonly)

Returns the value of attribute port.



11
12
13
# File 'lib/dalli/elasticache/auto_discovery/node.rb', line 11

def port
  @port
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
22
23
# File 'lib/dalli/elasticache/auto_discovery/node.rb', line 19

def ==(other)
  host == other.host &&
    ip == other.ip &&
    port == other.port
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/dalli/elasticache/auto_discovery/node.rb', line 25

def eql?(other)
  self == other
end

#hashObject



29
30
31
# File 'lib/dalli/elasticache/auto_discovery/node.rb', line 29

def hash
  [host, ip, port].hash
end

#to_sObject



33
34
35
# File 'lib/dalli/elasticache/auto_discovery/node.rb', line 33

def to_s
  "#{@host}:#{@port}"
end