Class: Undo::Storage::RailsCache
- Inherits:
-
Object
- Object
- Undo::Storage::RailsCache
- Defined in:
- lib/undo/storage/rails_cache.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Instance Method Summary collapse
- #fetch(uuid) ⇒ Object
-
#initialize(cache = nil, options = {}) ⇒ RailsCache
constructor
A new instance of RailsCache.
- #put(uuid, object) ⇒ Object
Constructor Details
#initialize(cache = nil, options = {}) ⇒ RailsCache
Returns a new instance of RailsCache.
8 9 10 11 12 |
# File 'lib/undo/storage/rails_cache.rb', line 8 def initialize(cache = nil, = {}) @cache = cache @cache ||= Rails.cache if defined? Rails = end |
Instance Method Details
#fetch(uuid) ⇒ Object
18 19 20 |
# File 'lib/undo/storage/rails_cache.rb', line 18 def fetch(uuid) deserialize cache.read uuid, end |
#put(uuid, object) ⇒ Object
14 15 16 |
# File 'lib/undo/storage/rails_cache.rb', line 14 def put(uuid, object) cache.write uuid, serialize(object), end |