lib/redis.rb in redis-2.0.11 vs lib/redis.rb in redis-2.0.12

- old
+ new

@@ -1,9 +1,9 @@ require 'socket' class Redis - VERSION = "2.0.11" + VERSION = "2.0.12" class ProtocolError < RuntimeError def initialize(reply_type) super(<<-EOS.gsub(/(?:^|\n)\s*/, " ")) Got '#{reply_type}' as initial reply byte. @@ -32,9 +32,17 @@ options[:port] ||= url.port options[:password] ||= url.password options[:db] ||= url.path[1..-1].to_i new(options) + end + + def self.current + Thread.current[:redis] ||= Redis.connect + end + + def self.current=(redis) + Thread.current[:redis] = redis end def initialize(options = {}) if options[:thread_safe] @client = Client::ThreadSafe.new(options)