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.
127 128 129 |
# File 'lib/memcached/rails.rb', line 127 def initialize(struct) @struct = struct end |
Instance Method Details
#alive? ⇒ Boolean
155 156 157 |
# File 'lib/memcached/rails.rb', line 155 def alive? @struct.fd != -1 || @struct.next_retry <= Time.now end |
#host ⇒ Object
131 132 133 |
# File 'lib/memcached/rails.rb', line 131 def host @struct.hostname end |
#inspect ⇒ Object
151 152 153 |
# File 'lib/memcached/rails.rb', line 151 def inspect "<Memcached::Rails::Server: %s:%d [%d] (%s)>" % [host, port, weight, status] end |
#multithreaded ⇒ Object
143 144 145 |
# File 'lib/memcached/rails.rb', line 143 def multithreaded true end |
#port ⇒ Object
135 136 137 |
# File 'lib/memcached/rails.rb', line 135 def port @struct.port end |
#status ⇒ Object
147 148 149 |
# File 'lib/memcached/rails.rb', line 147 def status alive? ? 'CONNECTED' : 'NOT CONNECTED' end |
#weight ⇒ Object
139 140 141 |
# File 'lib/memcached/rails.rb', line 139 def weight @struct.weight end |