class SwitchPoint::QueryCache

Public Class Methods

new(app, names = nil) click to toggle source
# File lib/switch_point/query_cache.rb, line 5
def initialize(app, names = nil)
  @app = app
  @names = names
end

Public Instance Methods

call(env) click to toggle source
# 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

Private Instance Methods

names() click to toggle source
# File lib/switch_point/query_cache.rb, line 18
def names
  @names ||= SwitchPoint.config.keys
end