Class: Sidekiq::RedisClientAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/redis_client_adapter.rb

Defined Under Namespace

Modules: CompatMethods Classes: CompatClient

Constant Summary collapse

BaseError =
RedisClient::Error
CommandError =
RedisClient::CommandError
DEPRECATED_COMMANDS =

You can add/remove items or clear the whole thing if you don’t want deprecation warnings.

%i[rpoplpush zrangebyscore zrevrange zrevrangebyscore getset hmset setex setnx].to_set

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ RedisClientAdapter

Returns a new instance of RedisClientAdapter.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/sidekiq/redis_client_adapter.rb', line 63

def initialize(options)
  opts = client_opts(options)
  @config = if opts.key?(:sentinels)
    RedisClient.sentinel(**opts)
  elsif opts.key?(:nodes)
    # Sidekiq does not support Redis clustering but Sidekiq Enterprise's
    # rate limiters are cluster-safe so we can scale to millions
    # of rate limiters using a Redis cluster. This requires the
    # `redis-cluster-client` gem.
    # Sidekiq::Limiter.redis = { nodes: [...] }
    RedisClient.cluster(**opts)
  else
    RedisClient.config(**opts)
  end
end

Instance Method Details

#new_clientObject



79
80
81
# File 'lib/sidekiq/redis_client_adapter.rb', line 79

def new_client
  CompatClient.new(@config.new_client)
end