Module: Concussion
- Defined in:
- lib/concussion/redis_adapter.rb,
lib/concussion.rb,
lib/concussion/persist.rb,
lib/concussion/version.rb
Overview
This adapter uses a Redis hash, as providing a list of normal keys matching a pattern is problematic. We manage key/value expiration outside Redis, to avoid jobs disappearing while the server is inactive.
Defined Under Namespace
Modules: Persist Classes: RedisAdapter
Constant Summary collapse
- VERSION =
"0.0.3"
Class Attribute Summary collapse
-
.store ⇒ Object
Returns the value of attribute store.
Class Method Summary collapse
Class Attribute Details
.store ⇒ Object
Returns the value of attribute store.
8 9 10 |
# File 'lib/concussion.rb', line 8 def store @store end |
Class Method Details
.init ⇒ Object
19 20 21 22 23 24 |
# File 'lib/concussion.rb', line 19 def self.init store.find_each do |guid, data| retire guid Object.const_get(data[:klass]).new.later data[:time], *(data[:args]) end end |
.persist(klass, guid, time, *args) ⇒ Object
11 12 13 |
# File 'lib/concussion.rb', line 11 def self.persist(klass, guid, time, *args) store.set guid, {klass: klass.name, time: time, args: args} end |
.retire(guid) ⇒ Object
15 16 17 |
# File 'lib/concussion.rb', line 15 def self.retire(guid) store.del guid end |