Method: Sparrow::Server#stats_command

Defined in:
lib/sparrow/server.rb

#stats_commandObject



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/sparrow/server.rb', line 209

def stats_command
  rsp = []
  stats_hash = Sparrow::Queue.get_stats(args[1])
  stats_hash.merge!({
    :curr_connections   => (self.connections_made - self.connections_lost),
    :total_connections  => self.connections_made,
    :bytes_read         => self.bytes_read,
    :bytes_written      => self.bytes_written,
    :get_count          => self.get_count,
    :set_count          => self.set_count
  })
  stats_hash.each do |key, value|
    rsp << [STATS, key, value].join(' ')
  end
  rsp << EOF
  send_data(rsp.join(CR) + CR)
end