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