Class: CacheStache::RackAfterReplyMiddleware
- Inherits:
-
Object
- Object
- CacheStache::RackAfterReplyMiddleware
- Defined in:
- lib/cache_stache/rack_after_reply_middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RackAfterReplyMiddleware
constructor
A new instance of RackAfterReplyMiddleware.
Constructor Details
#initialize(app) ⇒ RackAfterReplyMiddleware
Returns a new instance of RackAfterReplyMiddleware.
5 6 7 |
# File 'lib/cache_stache/rack_after_reply_middleware.rb', line 5 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cache_stache/rack_after_reply_middleware.rb', line 9 def call(env) return @app.call(env) unless CacheStache.configuration.use_rack_after_reply Thread.current[CacheStache::Instrumentation::AFTER_REPLY_QUEUE_KEY] = [] env["rack.after_reply"] ||= [] env["rack.after_reply"] << lambda do CacheStache::Instrumentation.flush_after_reply_queue! end @app.call(env) end |