Sha256: e195e64f47de1c6549a5e784b08f1122865752b0b69547bf604bd0f6d1885dba

Contents?: true

Size: 550 Bytes

Versions: 24

Compression:

Stored size: 550 Bytes

Contents

# frozen_string_literal: true

module SidekiqUniqueJobs
  # Shared module for dealing with redis connections
  #
  # @author Mikael Henriksson <mikael@zoolutions.se>
  module Connection
    def self.included(base)
      base.send(:extend, self)
    end

    # Creates a connection to redis
    # @return [Sidekiq::RedisConnection, ConnectionPool] a connection to redis
    def redis(redis_pool = nil)
      if redis_pool
        redis_pool.with { |conn| yield conn }
      else
        Sidekiq.redis { |conn| yield conn }
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-6.0.1 lib/sidekiq_unique_jobs/connection.rb
sidekiq-unique-jobs-6.0.0 lib/sidekiq_unique_jobs/connection.rb
sidekiq-unique-jobs-6.0.0.rc8 lib/sidekiq_unique_jobs/connection.rb
sidekiq-unique-jobs-6.0.0.rc7 lib/sidekiq_unique_jobs/connection.rb