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
activerecord-2.3.18 lib/active_record/query_cache.rb
activerecord_csi-2.3.5.p8 lib/active_record/query_cache.rb
activerecord-2.3.17 lib/active_record/query_cache.rb
activerecord_csi-2.3.5.p7 lib/active_record/query_cache.rb
activerecord_csi-2.3.5.p6 lib/active_record/query_cache.rb
activerecord-2.3.16 lib/active_record/query_cache.rb
activerecord-2.3.15 lib/active_record/query_cache.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/activerecord-2.3.14/lib/active_record/query_cache.rb
vanity-1.7.1 vendor/ruby/1.9.1/gems/activerecord-2.3.12/lib/active_record/query_cache.rb
activerecord-2.3.14 lib/active_record/query_cache.rb
kajam-1.0.3.rc2 vendor/rails/activerecord/lib/active_record/query_cache.rb
activerecord-2.3.12 lib/active_record/query_cache.rb
radiant-1.0.0.rc2 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiant-1.0.0.rc1 vendor/rails/activerecord/lib/active_record/query_cache.rb
webroar-0.5.0 src/admin_panel/vendor/rails/activerecord/lib/active_record/query_cache.rb
activerecord-2.3.11 lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.2.4 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.2.2 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.2.1 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.2 vendor/rails/activerecord/lib/active_record/query_cache.rb