class Undo::Storage::RailsCache
Attributes
cache[R]
Public Class Methods
new(cache = nil, options = {})
click to toggle source
Calls superclass method
# File lib/undo/storage/rails_cache.rb, line 6 def initialize(cache = nil, options = {}) @cache = cache @cache ||= Rails.cache if defined? Rails super options end
Public Instance Methods
delete(uuid, options = {})
click to toggle source
# File lib/undo/storage/rails_cache.rb, line 24 def delete(uuid, options = {}) cache.delete uuid, adapter_options(options) end
fetch(uuid, options = {})
click to toggle source
# File lib/undo/storage/rails_cache.rb, line 19 def fetch(uuid, options = {}) raise KeyError, "key #{uuid} not found" unless cache.exist? uuid unpack cache.read uuid, adapter_options(options) end
store(uuid, object, options = {})
click to toggle source
# File lib/undo/storage/rails_cache.rb, line 13 def store(uuid, object, options = {}) cache.write uuid, pack(object), adapter_options(options) end