Sha256: 727080e2c5246ef9b0ae918f55ae24a7b5ab4b75372dd0a525bb4a4b8de6cf6d

Contents?: true

Size: 414 Bytes

Versions: 1

Compression:

Stored size: 414 Bytes

Contents

# frozen_string_literal: true

module SwitchPoint
  class QueryCache
    def initialize(app, names = nil)
      @app = app
      @names = names
    end

    def call(env)
      names.reverse.inject(lambda { @app.call(env) }) do |func, name|
        lambda { ProxyRepository.checkout(name).cache(&func) }
      end.call
    end

    private

    def names
      @names ||= SwitchPoint.config.keys
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
switch_point-0.9.0 lib/switch_point/query_cache.rb