Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9940912bd2
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (31 sloc) 0.81 kb
module Flipper
module Middleware
class MongoSingleDocumentQueryCache
class Body
def initialize(target, adapter, original)
@target = target
@adapter = adapter
@original = original
end
def each(&block)
@target.each(&block)
end
def close
@target.close if @target.respond_to?(:close)
ensure
@adapter.document_cache = @original
end
end
def initialize(app, adapter)
@app = app
@adapter = adapter
end
def call(env)
original = @adapter.using_document_cache?
@adapter.document_cache = true
status, headers, body = @app.call(env)
[status, headers, Body.new(body, @adapter, original)]
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.