Class: ActionDispatch::RailsMetaStore

Inherits:
Rack::Cache::MetaStore
  • Object
show all
Defined in:
lib/action_dispatch/http/rack_cache.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store = Rails.cache) ⇒ RailsMetaStore

Returns a new instance of RailsMetaStore.



15
16
17
# File 'lib/action_dispatch/http/rack_cache.rb', line 15

def initialize(store = Rails.cache)
  @store = store
end

Class Method Details

.resolve(uri) ⇒ Object



11
12
13
# File 'lib/action_dispatch/http/rack_cache.rb', line 11

def self.resolve(uri)
  new
end

Instance Method Details

#read(key) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/action_dispatch/http/rack_cache.rb', line 19

def read(key)
  if data = @store.read(key)
    Marshal.load(data)
  else
    []
  end
end

#write(key, value) ⇒ Object



27
28
29
# File 'lib/action_dispatch/http/rack_cache.rb', line 27

def write(key, value)
  @store.write(key, Marshal.dump(value))
end