Module: Wurk::RedisConnection

Defined in:
lib/wurk/redis_connection.rb

Overview

Sidekiq-compatible pool constructor. Sidekiq::RedisConnection.create(...) is the documented way to build a standalone Redis pool (spec §26) — it's the default pool for Sidekiq::Deploy (§23). Returns a Wurk::RedisPool (connection_pool-backed, redis-client adapter), which is .with-compatible with everything that expects a Sidekiq pool.

Pro §10.2 pool-bound multi-shard web mounts (Sidekiq::Pro::Web.with) are unsupported: Wurk::Web has no .with factory.

Accepts Sidekiq's option keys (url, size, pool_timeout, pool_name, and name — the Sentinel master next to sentinels:) plus the socket knobs (connect_timeout/read_timeout/write_timeout/ reconnect_attempts/driver), string- or symbol-keyed. Anything omitted falls back to RedisPool's defaults (URL = ENV or redis://localhost:6379/0).

Constant Summary collapse

DEFAULT_POOL_SIZE =

Housekeeping/standalone default; per-capsule pools size to concurrency.

10

Class Method Summary collapse

Class Method Details

.create(options = {}) ⇒ Object



25
26
27
28
29
30
# File 'lib/wurk/redis_connection.rb', line 25

def self.create(options = {})
  opts = options.transform_keys(&:to_sym)
  RedisPool.new(size: opts[:size] || DEFAULT_POOL_SIZE,
                name: opts[:pool_name] || RedisPool::DEFAULT_NAME,
                **RedisOptions.pool_kwargs(opts))
end