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 178
178:       def initialize(hash={})
179:         @hash = hash
180:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 203
203:       def self.resolve(uri)
204:         new
205:       end

Public Instance methods

[Source]

     # File lib/rack/cache/metastore.rb, line 194
194:       def purge(key)
195:         @hash.delete(key)
196:         nil
197:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 182
182:       def read(key)
183:         if data = @hash[key]
184:           Marshal.load(data)
185:         else
186:           []
187:         end
188:       end

[Source]

     # File lib/rack/cache/metastore.rb, line 199
199:       def to_hash
200:         @hash
201:       end

[Source]

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

[Validate]