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, GAE, GAECACHE, HEAP, MEM, MEMCACHE, MEMCACHED
Class Method Summary
collapse
Instance Method Summary
collapse
#cache_key, #invalidate, #lookup, #store
Constructor Details
#initialize(hash = {}) ⇒ Heap
Returns a new instance of Heap.
178
179
180
|
# File 'lib/rack/cache/metastore.rb', line 178
def initialize(hash={})
@hash = hash
end
|
Class Method Details
.resolve(uri) ⇒ Object
203
204
205
|
# File 'lib/rack/cache/metastore.rb', line 203
def self.resolve(uri)
new
end
|
Instance Method Details
#purge(key) ⇒ Object
194
195
196
197
|
# File 'lib/rack/cache/metastore.rb', line 194
def purge(key)
@hash.delete(key)
nil
end
|
#read(key) ⇒ Object
182
183
184
185
186
187
188
|
# File 'lib/rack/cache/metastore.rb', line 182
def read(key)
if data = @hash[key]
Marshal.load(data)
else
[]
end
end
|
#to_hash ⇒ Object
199
200
201
|
# File 'lib/rack/cache/metastore.rb', line 199
def to_hash
@hash
end
|
#write(key, entries) ⇒ Object
190
191
192
|
# File 'lib/rack/cache/metastore.rb', line 190
def write(key, entries)
@hash[key] = Marshal.dump(entries)
end
|