Module: SidekiqUniqueJobs::Unlockable
- Defined in:
- lib/sidekiq_unique_jobs/unlockable.rb
Overview
Utility module to help manage unique keys in redis. Useful for deleting keys that for whatever reason wasn’t deleted
Class Method Summary collapse
-
.delete(item) ⇒ Object
Deletes a lock unless it has ttl.
-
.delete!(item) ⇒ Object
Deletes a lock regardless of if it was locked or has ttl.
-
.unlock(item) ⇒ Object
Unlocks a job.
-
.unlock!(item) ⇒ Object
Unlocks a job.
Class Method Details
.delete(item) ⇒ Object
Deletes a lock unless it has ttl
This is good for situations when a job is locked by another item
29 30 31 32 |
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 29 def delete(item) SidekiqUniqueJobs::Job.add_digest(item) SidekiqUniqueJobs::Locksmith.new(item).delete end |
.delete!(item) ⇒ Object
Deletes a lock regardless of if it was locked or has ttl.
This is good for situations when a job is locked by another item
38 39 40 41 |
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 38 def delete!(item) SidekiqUniqueJobs::Job.add_digest(item) SidekiqUniqueJobs::Locksmith.new(item).delete! end |
.unlock(item) ⇒ Object
Unlocks a job.
13 14 15 16 |
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 13 def unlock(item) SidekiqUniqueJobs::Job.add_digest(item) SidekiqUniqueJobs::Locksmith.new(item).unlock end |
.unlock!(item) ⇒ Object
Unlocks a job.
20 21 22 23 |
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 20 def unlock!(item) SidekiqUniqueJobs::Job.add_digest(item) SidekiqUniqueJobs::Locksmith.new(item).unlock! end |