Skip to content

Instantly share code, notes, and snippets.

@semarco
Created July 18, 2012 15:37
Show Gist options
  • Save semarco/3136990 to your computer and use it in GitHub Desktop.
Save semarco/3136990 to your computer and use it in GitHub Desktop.
em::hiredis example
EM.run do
c = EM::Hiredis.connect('redis://127.0.0.1:6379/0')
puts c.inspect
c.callback {puts 'connected'};
c.errback {puts 'error'}
c.publish('test', 'foo:bar').tap do |r|
r.callback {puts 'request with success'};
r.errback { |e| puts 'request with error'; puts e.inspect}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment