Class: ActionDispatch::RailsMetaStore

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store = RAILS_CACHE) ⇒ RailsMetaStore

TODO: Finally deal with the RAILS_CACHE global



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

def initialize(store = RAILS_CACHE)
  @store = store
end

Class Method Details

.resolve(uri) ⇒ Object



7
8
9
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 7

def self.resolve(uri)
  new
end

Instance Method Details

#read(key) ⇒ Object



16
17
18
19
20
21
22
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 16

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

#write(key, value) ⇒ Object



24
25
26
# File 'actionpack/lib/action_dispatch/http/rack_cache.rb', line 24

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