Class: Rack::Cache::MetaStore::Heap
Overview
Concrete MetaStore implementation that uses a simple Hash to store request/response pairs on the heap.
Constant Summary
DISK, FILE, HEAP, MEM, MEMCACHE, MEMCACHED
Class Method Summary
collapse
Instance Method Summary
collapse
#lookup, #store
Constructor Details
#initialize(hash = {}) ⇒ Heap
Returns a new instance of Heap.
137
138
139
|
# File 'lib/rack/cache/metastore.rb', line 137
def initialize(hash={})
@hash = hash
end
|
Class Method Details
.resolve(uri) ⇒ Object
160
161
162
|
# File 'lib/rack/cache/metastore.rb', line 160
def self.resolve(uri)
new
end
|
Instance Method Details
#purge(key) ⇒ Object
151
152
153
154
|
# File 'lib/rack/cache/metastore.rb', line 151
def purge(key)
@hash.delete(key)
nil
end
|
#read(key) ⇒ Object
141
142
143
144
145
|
# File 'lib/rack/cache/metastore.rb', line 141
def read(key)
@hash.fetch(key, []).collect do |req,res|
[req.dup, res.dup]
end
end
|
#to_hash ⇒ Object
156
157
158
|
# File 'lib/rack/cache/metastore.rb', line 156
def to_hash
@hash
end
|
#write(key, entries) ⇒ Object
147
148
149
|
# File 'lib/rack/cache/metastore.rb', line 147
def write(key, entries)
@hash[key] = entries
end
|