Skip to content

Instantly share code, notes, and snippets.

@laurynas
Created June 12, 2016 05:14
Show Gist options
  • Save laurynas/4aeb7cad3bb397d14a15308cc8d97362 to your computer and use it in GitHub Desktop.
Save laurynas/4aeb7cad3bb397d14a15308cc8d97362 to your computer and use it in GitHub Desktop.
Debug memached socket timeouts
#!/usr/bin/env ruby
require 'socket'
s = UNIXServer.new '/tmp/dummymemcached'
#s = TCPServer.new 11212
loop do
c = s.accept
line = c.gets
puts line
sleep 2
end
@laurynas
Copy link
Author

Client:

#!/usr/bin/env ruby

require 'rubygems'
gem 'memcached'
require 'memcached'

cache = Memcached.new("/tmp/dummymemcached", timeout: 0.1)
#cache = Memcached.new('localhost:11212', timeout: 0.1)

value = 'hello'
cache.set 'test', value

p cache.get 'test'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment