class SidekiqUniqueJobs::OnConflict::Strategy

Abstract conflict strategy class

@abstract @author Mikael Henriksson <mikael@mhenrixon.com>

Attributes

item[R]

@!attribute [r] item

@return [Hash] sidekiq job hash
redis_pool[R]

@!attribute [r] redis_pool

@return [Sidekiq::RedisConnection, ConnectionPool, NilClass] the redis connection

Public Class Methods

new(item, redis_pool = nil) click to toggle source

Initialize a new Strategy

@param [Hash] item sidekiq job hash @param [ConnectionPool] redis_pool the connection pool instance

# File lib/sidekiq_unique_jobs/on_conflict/strategy.rb, line 28
def initialize(item, redis_pool = nil)
  @item       = item
  @redis_pool = redis_pool
end

Public Instance Methods

call() click to toggle source

Use strategy on conflict @raise [NotImplementedError] needs to be implemented in child class

# File lib/sidekiq_unique_jobs/on_conflict/strategy.rb, line 35
def call
  raise NotImplementedError, "needs to be implemented in child class"
end
replace?() click to toggle source

Check if the strategy is kind of {Replace}

@return [true] when the strategy is a {Replace} @return [false] when the strategy is not a {Replace}

# File lib/sidekiq_unique_jobs/on_conflict/strategy.rb, line 46
def replace?
  is_a?(Replace)
end