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.



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

def initialize(struct)
  @struct = struct
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


160
161
162
# File 'lib/memcached/rails.rb', line 160

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

#hostObject



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

def host
  @struct.hostname
end

#inspectObject



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

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

#multithreadedObject



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

def multithreaded
  true
end

#portObject



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

def port
  @struct.port
end

#statusObject



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

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

#weightObject



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

def weight
  @struct.weight
end