简体   繁体   中英

How can I know about Memcache status in my Rails app?

I created a Rails app hosted on Heroku with a Memcache plugin limited to 5 MB.

How can I know about Memcache status, free cache left, biggest cache chunk etc.? Can I access this within the app (an admin page for example)? Or using the Ruby console? Also, is there any graphical plugin for this?

From http://barkingiguana.com/2009/03/04/memcache-statistics-from-the-command-line

require 'socket'

socket = TCPSocket.open('localhost', '11211')
socket.send("stats\r\n", 0)

statistics = []
loop do
  data = socket.recv(4096)
  if !data || data.length == 0
    break
  end
  statistics << data
  if statistics.join.split(/\n/)[-1] =~ /END/
    break
  end
end

puts statistics.join()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM