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={}, options = {})
click to toggle source
# File lib/rack/cache/meta_store.rb 202 def initialize(hash={}, options = {}) 203 @hash = hash 204 @options = options 205 end
resolve(uri, options = {})
click to toggle source
# File lib/rack/cache/meta_store.rb 228 def self.resolve(uri, options = {}) 229 new({}, options) 230 end
Public Instance Methods
purge(key)
click to toggle source
# File lib/rack/cache/meta_store.rb 219 def purge(key) 220 @hash.delete(key) 221 nil 222 end
read(key)
click to toggle source
# File lib/rack/cache/meta_store.rb 207 def read(key) 208 if data = @hash[key] 209 Marshal.load(data) 210 else 211 [] 212 end 213 end
to_hash()
click to toggle source
# File lib/rack/cache/meta_store.rb 224 def to_hash 225 @hash 226 end
write(key, entries, ttl = nil)
click to toggle source
# File lib/rack/cache/meta_store.rb 215 def write(key, entries, ttl = nil) 216 @hash[key] = Marshal.dump(entries) 217 end