Class: Memcached::Server
- Inherits:
-
Object
- Object
- Memcached::Server
- Defined in:
- lib/memcached/rails.rb
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #host ⇒ Object
-
#initialize(struct) ⇒ Server
constructor
A new instance of Server.
- #inspect ⇒ Object
- #multithreaded ⇒ Object
- #port ⇒ Object
- #status ⇒ Object
- #weight ⇒ Object
Constructor Details
#initialize(struct) ⇒ Server
Returns a new instance of Server.
132 133 134 |
# File 'lib/memcached/rails.rb', line 132 def initialize(struct) @struct = struct end |
Instance Method Details
#alive? ⇒ Boolean
160 161 162 |
# File 'lib/memcached/rails.rb', line 160 def alive? @struct.fd != -1 || @struct.next_retry <= Time.now end |
#host ⇒ Object
136 137 138 |
# File 'lib/memcached/rails.rb', line 136 def host @struct.hostname end |
#inspect ⇒ Object
156 157 158 |
# File 'lib/memcached/rails.rb', line 156 def inspect "<Memcached::Rails::Server: %s:%d [%d] (%s)>" % [host, port, weight, status] end |
#multithreaded ⇒ Object
148 149 150 |
# File 'lib/memcached/rails.rb', line 148 def multithreaded true end |
#port ⇒ Object
140 141 142 |
# File 'lib/memcached/rails.rb', line 140 def port @struct.port end |
#status ⇒ Object
152 153 154 |
# File 'lib/memcached/rails.rb', line 152 def status alive? ? 'CONNECTED' : 'NOT CONNECTED' end |
#weight ⇒ Object
144 145 146 |
# File 'lib/memcached/rails.rb', line 144 def weight @struct.weight end |