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
radiantcms-couchrest_model-0.1.9 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.1.8 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.1.7 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.1.6 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.1.5 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.1.4 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.1.3 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.1.2 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.1.1 vendor/rails/activerecord/lib/active_record/query_cache.rb
radiantcms-couchrest_model-0.1 vendor/rails/activerecord/lib/active_record/query_cache.rb
activerecord-2.3.10 lib/active_record/query_cache.rb
activerecord-2.3.9 lib/active_record/query_cache.rb
activerecord-2.3.9.pre lib/active_record/query_cache.rb
webroar-0.4.0 src/admin_panel/vendor/rails/activerecord/lib/active_record/query_cache.rb
radiant-0.9.1 vendor/rails/activerecord/lib/active_record/query_cache.rb
activerecord-2.3.8 lib/active_record/query_cache.rb
activerecord-2.3.8.pre1 lib/active_record/query_cache.rb
activerecord-2.3.7 lib/active_record/query_cache.rb
activerecord-2.3.6 lib/active_record/query_cache.rb
radiant-0.8.2 vendor/rails/activerecord/lib/active_record/query_cache.rb