Module: SidekiqUniqueJobs::Connection

Included in:
SidekiqUniqueJobs, Digests, Locksmith, Scripts, Util
Defined in:
lib/sidekiq_unique_jobs/connection.rb

Overview

Shared module for dealing with redis connections

Instance Method Summary collapse

Instance Method Details

#redis(redis_pool = nil) ⇒ Sidekiq::RedisConnection, ConnectionPool

Creates a connection to redis

Returns:

  • (Sidekiq::RedisConnection, ConnectionPool)

    a connection to redis



14
15
16
17
18
19
20
# File 'lib/sidekiq_unique_jobs/connection.rb', line 14

def redis(redis_pool = nil)
  if redis_pool
    redis_pool.with { |conn| yield conn }
  else
    Sidekiq.redis { |conn| yield conn }
  end
end