box-o-sand/memcached/ruby/plain.rb
2013-01-26 09:28:29 -05:00

25 lines
320 B
Ruby

require 'socket'
def main
@client = TCPSocket.new('localhost', 11211)
@client.puts ARGV.first
while line = @client.gets
puts line
case line.chomp
when 'END'
break
when 'ERROR'
return 1
end
end
return 0
ensure
@client.close if @client
end
if $0 == __FILE__
exit main
end