Skip to content

Instantly share code, notes, and snippets.

@bjonord
Forked from bradediger/gist:4137531
Created August 19, 2014 15:31
Show Gist options
  • Save bjonord/1c6a599fefefd7f6d081 to your computer and use it in GitHub Desktop.
Save bjonord/1c6a599fefefd7f6d081 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
hits_ = nil
misses_ = nil
loop do
`redis-cli info | grep keyspace` =~ /hits:(\d+).*misses:(\d+)/m
hits, misses = $1.to_i, $2.to_i
if hits_
dhits = hits - hits_
dmisses = misses - misses_
puts "%d: %.02f%% (%d / %d)" % [Time.now.to_i, dhits * 100.0 / (dhits + dmisses),
dhits, dmisses]
end
hits_ = hits
misses_ = misses
sleep 10
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment