Class: Sidekiq::RedisConnection::RedisAdapter
- Inherits:
-
Object
- Object
- Sidekiq::RedisConnection::RedisAdapter
- Defined in:
- lib/sidekiq/redis_connection.rb
Constant Summary collapse
- BaseError =
Redis::BaseError
- CommandError =
Redis::CommandError
Instance Method Summary collapse
-
#initialize(options) ⇒ RedisAdapter
constructor
A new instance of RedisAdapter.
- #new_client ⇒ Object
Constructor Details
#initialize(options) ⇒ RedisAdapter
Returns a new instance of RedisAdapter.
13 14 15 16 |
# File 'lib/sidekiq/redis_connection.rb', line 13 def initialize() warn("Usage of the 'redis' gem within Sidekiq itself is deprecated, Sidekiq 7.0 will only use the new, simpler 'redis-client' gem", caller) if ENV["SIDEKIQ_REDIS_CLIENT"] == "1" @options = end |
Instance Method Details
#new_client ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sidekiq/redis_connection.rb', line 18 def new_client namespace = @options[:namespace] client = Redis.new client_opts(@options) if namespace begin require "redis/namespace" Redis::Namespace.new(namespace, redis: client) rescue LoadError Sidekiq.logger.error("Your Redis configuration uses the namespace '#{namespace}' but the redis-namespace gem is not included in the Gemfile." \ "Add the gem to your Gemfile to continue using a namespace. Otherwise, remove the namespace parameter.") exit(-127) end else client end end |