Class: Emb::Middleware
- Inherits:
-
Object
- Object
- Emb::Middleware
- Defined in:
- lib/emb/middleware.rb
Overview
Rack middleware that clears the per-thread batch scope at the end of each request, bounding cache growth in long-lived request threads. The scope is cleared even when the app raises; a fresh scope starts with the next request.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
10 11 12 |
# File 'lib/emb/middleware.rb', line 10 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 |
# File 'lib/emb/middleware.rb', line 14 def call(env) @app.call(env) ensure BatchLoader::Executor.clear_current end |