Class: Undo::Storage::Redis
- Inherits:
-
Adapter
- Object
- Adapter
- Undo::Storage::Redis
- Defined in:
- lib/undo/storage/redis.rb
Instance Method Summary collapse
- #delete(uuid, options = {}) ⇒ Object
- #fetch(uuid, options = {}) ⇒ Object
-
#initialize(redis, options = {}) ⇒ Redis
constructor
A new instance of Redis.
- #store(uuid, object, options = {}) ⇒ Object
Constructor Details
#initialize(redis, options = {}) ⇒ Redis
Returns a new instance of Redis.
7 8 9 10 |
# File 'lib/undo/storage/redis.rb', line 7 def initialize(redis, = {}) @redis = redis super end |
Instance Method Details
#delete(uuid, options = {}) ⇒ Object
23 24 25 |
# File 'lib/undo/storage/redis.rb', line 23 def delete(uuid, = {}) redis.del uuid end |
#fetch(uuid, options = {}) ⇒ Object
18 19 20 21 |
# File 'lib/undo/storage/redis.rb', line 18 def fetch(uuid, = {}) data = redis.get(uuid) or raise KeyError, "key #{uuid} not found" unpack data end |
#store(uuid, object, options = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/undo/storage/redis.rb', line 12 def store(uuid, object, = {}) redis.set uuid, pack(object), () end |