Skip to content

Commit

Permalink
Support redis:// format. Closes resque#133
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Aug 9, 2010
1 parent d75e0d6 commit 8f5ff34
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/resque.rb
Expand Up @@ -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
Expand Down

0 comments on commit 8f5ff34

Please sign in to comment.