This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Support redis:// format. Closes #133

  • Loading branch information...
defunkt committed Aug 9, 2010
1 parent d75e0d6 commit 8f5ff340b2cc708f1487aed20db5e64df1e4d5fe
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/resque.rb
View
@@ -30,9 +30,14 @@ module Resque
# or `Redis::Namespace`.
def redis=(server)
if server.respond_to? :split
- host, port, db = server.split(':')
- redis = Redis.new(:host => host, :port => port,
- :thread_safe => true, :db => db)
+ if server =~ /redis\:\/\//
+ redis = Redis.connect(:url => server)
+ else
+ host, port, db = server.split(':')
+ redis = Redis.new(:host => host, :port => port,
+ :thread_safe => true, :db => db)
+ end
+
@redis = Redis::Namespace.new(:resque, :redis => redis)
elsif server.respond_to? :namespace=
@redis = server

0 comments on commit 8f5ff34

Please sign in to comment.