Sha256: 38bb72a78cc0d3a6067d959cadbb4ea601c935a143a1f3b96abf79d6e0a5f050
Contents?: true
Size: 810 Bytes
Versions: 2
Compression:
Stored size: 810 Bytes
Contents
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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flipper-mongo-0.3.0 | lib/flipper/middleware/mongo_single_document_query_cache.rb |
flipper-mongo-0.2.2 | lib/flipper/middleware/mongo_single_document_query_cache.rb |