I can't believe I've never directly played around with memcached :P
This commit is contained in:
parent
150a3745f6
commit
ab43fb0146
24
ruby-memcached/plain.rb
Normal file
24
ruby-memcached/plain.rb
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user