From ab43fb0146f2873dde5966512cf245a8ee485d95 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Tue, 22 Jan 2013 19:07:35 -0500 Subject: [PATCH] I can't believe I've never directly played around with memcached :P --- ruby-memcached/plain.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ruby-memcached/plain.rb diff --git a/ruby-memcached/plain.rb b/ruby-memcached/plain.rb new file mode 100644 index 0000000..8fa88b4 --- /dev/null +++ b/ruby-memcached/plain.rb @@ -0,0 +1,24 @@ +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