Class: Memcached::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/memcached/rails.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


155
156
157
# File 'lib/memcached/rails.rb', line 155

def alive?
  @struct.fd != -1 || @struct.next_retry <= Time.now
end

#hostObject



131
132
133
# File 'lib/memcached/rails.rb', line 131

def host
  @struct.hostname
end

#inspectObject



151
152
153
# File 'lib/memcached/rails.rb', line 151

def inspect
  "<Memcached::Rails::Server: %s:%d [%d] (%s)>" % [host, port, weight, status]
end

#multithreadedObject



143
144
145
# File 'lib/memcached/rails.rb', line 143

def multithreaded
  true
end

#portObject



135
136
137
# File 'lib/memcached/rails.rb', line 135

def port
  @struct.port
end

#statusObject



147
148
149
# File 'lib/memcached/rails.rb', line 147

def status
  alive? ? 'CONNECTED' : 'NOT CONNECTED'
end

#weightObject



139
140
141
# File 'lib/memcached/rails.rb', line 139

def weight
  @struct.weight
end