class SidekiqUniqueJobs::Key
Key
class wraps logic dealing with various lock keys
@author Mikael Henriksson <mikael@mhenrixon.com>
Attributes
changelog[R]
@!attribute [r] changelog
@return [String] the zset with changelog entries
digest[R]
@!attribute [r] digest
@return [String] the digest key for which keys are created
digests[R]
@!attribute [r] digests
@return [String] the zset with locked digests
info[R]
@!attribute [r] info
@return [String] information about the lock
locked[R]
@!attribute [r] locked
@return [String] the hash key with locked job_id's
primed[R]
@!attribute [r] primed
@return [String] the list key with primed job_id's
queued[R]
@!attribute [r] queued
@return [String] the list key with queued job_id's
Public Class Methods
new(digest)
click to toggle source
Initialize a new Key
@param [String] digest the digest to use as key
# File lib/sidekiq_unique_jobs/key.rb, line 42 def initialize(digest) @digest = digest @queued = suffixed_key("QUEUED") @primed = suffixed_key("PRIMED") @locked = suffixed_key("LOCKED") @info = suffixed_key("INFO") @changelog = CHANGELOGS @digests = DIGESTS end
Public Instance Methods
==(other)
click to toggle source
Compares keys by digest
@param [Key] other the key to compare with
@return [true, false]
# File lib/sidekiq_unique_jobs/key.rb, line 74 def ==(other) digest == other.digest end
inspect()
click to toggle source
@see to_s
# File lib/sidekiq_unique_jobs/key.rb, line 63 def inspect digest end
to_a()
click to toggle source
Returns all keys as an ordered array
@return [Array] an ordered array with all keys
# File lib/sidekiq_unique_jobs/key.rb, line 83 def to_a [digest, queued, primed, locked, info, changelog, digests] end
to_s()
click to toggle source
Provides the only important information about this keys
@return [String]
# File lib/sidekiq_unique_jobs/key.rb, line 58 def to_s digest end
Private Instance Methods
suffixed_key(variable)
click to toggle source
# File lib/sidekiq_unique_jobs/key.rb, line 89 def suffixed_key(variable) "#{digest}:#{variable}" end