Class: FastCache::Memcache::Node
- Inherits:
-
Object
- Object
- FastCache::Memcache::Node
- Defined in:
- lib/fastcache/memcache/node.rb
Constant Summary collapse
- CONNECT_TIMEOUT =
0.25
- RETRY_DELAY =
10.0
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#weight ⇒ Object
Returns the value of attribute weight.
Instance Method Summary collapse
- #close ⇒ Object
- #connect ⇒ Object
- #gets ⇒ Object
-
#initialize(host, port) ⇒ Node
constructor
A new instance of Node.
- #read(*a) ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize(host, port) ⇒ Node
Returns a new instance of Node.
11 12 13 14 15 16 17 18 |
# File 'lib/fastcache/memcache/node.rb', line 11 def initialize(host, port) @host = host @port = port @weight = 1 @status = :disconnected @socket = nil @retry = nil end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/fastcache/memcache/node.rb', line 5 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/fastcache/memcache/node.rb', line 5 def port @port end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/fastcache/memcache/node.rb', line 5 def status @status end |
#weight ⇒ Object
Returns the value of attribute weight.
6 7 8 |
# File 'lib/fastcache/memcache/node.rb', line 6 def weight @weight end |
Instance Method Details
#close ⇒ Object
32 33 34 35 |
# File 'lib/fastcache/memcache/node.rb', line 32 def close socket.close @socket = nil end |
#connect ⇒ Object
37 38 39 |
# File 'lib/fastcache/memcache/node.rb', line 37 def connect socket end |
#gets ⇒ Object
28 29 30 |
# File 'lib/fastcache/memcache/node.rb', line 28 def gets socket.gets end |
#read(*a) ⇒ Object
20 21 22 |
# File 'lib/fastcache/memcache/node.rb', line 20 def read(*a) socket.read(*a) end |
#write(data) ⇒ Object
24 25 26 |
# File 'lib/fastcache/memcache/node.rb', line 24 def write(data) socket.write(data) end |