Simple RedisToGo connection

I did this many times before, but it keeps cropping up (I’m not at all sure why.) Here it is…

require 'rubygems'
require 'uri'
require 'redis'

#RedisToGo gives you the "redis://" uri.
uri = URI.parse('redis://username:password@host:1234/')
unless uri.nil?
  p uri.host
  p uri.port
  p uri.password
  p '---'
  r = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password, :thread_safe => true)
  p r.info
end

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s