Class Rack::Cache::MetaStore::Heap
In: lib/rack/cache/metastore.rb
Parent: MetaStore

Concrete MetaStore implementation that uses a simple Hash to store request/response pairs on the heap.

Methods

new   purge   read   resolve   to_hash   write  

Public Class methods

[Source]

     # File lib/rack/cache/metastore.rb, line 174
174:       def initialize(hash={})
175:         @hash = hash
176:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 199
199:       def self.resolve(uri)
200:         new
201:       end

Public Instance methods

[Source]

     # File lib/rack/cache/metastore.rb, line 190
190:       def purge(key)
191:         @hash.delete(key)
192:         nil
193:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 178
178:       def read(key)
179:         if data = @hash[key]
180:           Marshal.load(data)
181:         else
182:           []
183:         end
184:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 195
195:       def to_hash
196:         @hash
197:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 186
186:       def write(key, entries)
187:         @hash[key] = Marshal.dump(entries)
188:       end

[Validate]