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