Created
July 20, 2009 19:37
-
-
Save craigw/150815 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment