Class Rack::Cache::MetaStore::Heap

  1. lib/rack/cache/metastore.rb

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

Methods

public class

  1. new
  2. resolve

public instance

  1. purge
  2. read
  3. to_hash
  4. write

Public class methods

new (hash={})
[show source]
     # File lib/rack/cache/metastore.rb, line 173
173:       def initialize(hash={})
174:         @hash = hash
175:       end
resolve (uri)
[show source]
     # File lib/rack/cache/metastore.rb, line 196
196:       def self.resolve(uri)
197:         new
198:       end

Public instance methods

purge (key)
[show source]
     # File lib/rack/cache/metastore.rb, line 187
187:       def purge(key)
188:         @hash.delete(key)
189:         nil
190:       end
read (key)
[show source]
     # File lib/rack/cache/metastore.rb, line 177
177:       def read(key)
178:         @hash.fetch(key, []).collect do |req,res|
179:           [req.dup, res.dup]
180:         end
181:       end
to_hash ()
[show source]
     # File lib/rack/cache/metastore.rb, line 192
192:       def to_hash
193:         @hash
194:       end
write (key, entries)
[show source]
     # File lib/rack/cache/metastore.rb, line 183
183:       def write(key, entries)
184:         @hash[key] = entries
185:       end