Class: BufferedJob::Lock
- Inherits:
-
Object
- Object
- BufferedJob::Lock
- Defined in:
- lib/buffered_job.rb
Class Method Summary collapse
Class Method Details
.cache ⇒ Object
47 48 49 |
# File 'lib/buffered_job.rb', line 47 def self.cache @@cache ||= defined?(Rails) ? Rails.cache : ActiveSupport::Cache::MemoryStore.new end |
.lock! ⇒ Object
51 52 53 |
# File 'lib/buffered_job.rb', line 51 def self.lock! cache.write("mail_buffer_lock",true,:expires_in => 10.minutes) end |
.locked? ⇒ Boolean
59 60 61 |
# File 'lib/buffered_job.rb', line 59 def self.locked? cache.exist?("mail_buffer_lock") end |
.unlock! ⇒ Object
55 56 57 |
# File 'lib/buffered_job.rb', line 55 def self.unlock! cache.delete("mail_buffer_lock") end |