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.
5 6 7 8 |
# File 'lib/switch_point/query_cache.rb', line 5 def initialize(app, names = nil) @app = app @names = names end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 |
# File 'lib/switch_point/query_cache.rb', line 10 def call(env) names.reverse.inject(lambda { @app.call(env) }) do |func, name| lambda { ProxyRepository.checkout(name).cache(&func) } end.call end |