class Rack::Cache::EntityStore
which becomes the response body’s key.
Implementations are required to calculate a SHA checksum of the data written
Entity stores are used to cache response bodies across requests. All
def bytesize(string); string.bytesize; end
def bytesize(string); string.bytesize; end
def bytesize(string); string.size; end
def bytesize(string); string.size; end
def slurp(body)
call it after iteration is complete. Return a two-tuple of the form:
yielding each chunk to the block. If the body responds to close,
Read body calculating the SHA1 checksum and size while
def slurp(body) digest, size = Digest::SHA1.new, 0 body.each do |part| size += bytesize(part) digest << part yield part end body.close if body.respond_to? :close [digest.hexdigest, size] end