Method: Dalli::Client#stats

Defined in:
lib/dalli/client.rb

#stats(type = nil) ⇒ Object

Collect the stats for each server. You can optionally pass a type including :items, :slabs or :settings to get specific stats Returns a hash like { ‘hostname:port’ => { ‘stat1’ => ‘value1’, … }, ‘hostname2:port’ => { … } }



313
314
315
316
317
318
319
320
# File 'lib/dalli/client.rb', line 313

def stats(type = nil)
  type = nil unless ALLOWED_STAT_KEYS.include? type
  values = {}
  ring.servers.each do |server|
    values[server.name.to_s] = server.alive? ? server.request(:stats, type.to_s) : nil
  end
  values
end