Class: SwitchPoint::QueryCache
- Inherits:
-
Object
- Object
- SwitchPoint::QueryCache
- Defined in:
- lib/switch_point/query_cache.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, names = nil) ⇒ QueryCache
constructor
A new instance of QueryCache.
Constructor Details
#initialize(app, names = nil) ⇒ QueryCache
Returns a new instance of QueryCache.
3 4 5 6 |
# File 'lib/switch_point/query_cache.rb', line 3 def initialize(app, names = nil) @app = app @names = names end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 |
# File 'lib/switch_point/query_cache.rb', line 8 def call(env) names.reverse.inject(lambda { @app.call(env) }) do |func, name| lambda { ProxyRepository.checkout(name).cache(&func) } end.call end |