Sha256: f0c1ea8df60f8d61df539e5a3f31a345f11f615436e7edca8a41855593971ed1

Contents?: true

Size: 717 Bytes

Versions: 66

Compression:

Stored size: 717 Bytes

Contents

module ActiveRecord
  class QueryCache
    module ClassMethods
      # Enable the query cache within the block if Active Record is configured.
      def cache(&block)
        if ActiveRecord::Base.configurations.blank?
          yield
        else
          connection.cache(&block)
        end
      end

      # Disable the query cache within the block if Active Record is configured.
      def uncached(&block)
        if ActiveRecord::Base.configurations.blank?
          yield
        else
          connection.uncached(&block)
        end
      end
    end

    def initialize(app)
      @app = app
    end

    def call(env)
      ActiveRecord::Base.cache do
        @app.call(env)
      end
    end
  end
end

Version data entries

66 entries across 65 versions & 12 rubygems

Version Path
webroar-0.2.2 src/admin_panel/vendor/rails/activerecord/lib/active_record/query_cache.rb
radiant-0.8.1 vendor/rails/activerecord/lib/active_record/query_cache.rb
activerecord-2.3.4 lib/active_record/query_cache.rb
activerecord-2.3.3 lib/active_record/query_cache.rb
activerecord-2.3.2 lib/active_record/query_cache.rb
radiant-0.8.0 vendor/rails/activerecord/lib/active_record/query_cache.rb