class Rack::Cache::MetaStore::Heap

Concrete MetaStore implementation that uses a simple Hash to store request/response pairs on the heap.

Public Class Methods

new(hash={}) click to toggle source
    # File lib/rack/cache/meta_store.rb
189 def initialize(hash={})
190   @hash = hash
191 end
resolve(uri) click to toggle source
    # File lib/rack/cache/meta_store.rb
214 def self.resolve(uri)
215   new
216 end

Public Instance Methods

purge(key) click to toggle source
    # File lib/rack/cache/meta_store.rb
205 def purge(key)
206   @hash.delete(key)
207   nil
208 end
read(key) click to toggle source
    # File lib/rack/cache/meta_store.rb
193 def read(key)
194   if data = @hash[key]
195     Marshal.load(data)
196   else
197     []
198   end
199 end
to_hash() click to toggle source
    # File lib/rack/cache/meta_store.rb
210 def to_hash
211   @hash
212 end
write(key, entries) click to toggle source
    # File lib/rack/cache/meta_store.rb
201 def write(key, entries)
202   @hash[key] = Marshal.dump(entries)
203 end