Sha256: 4e1719f42a8acce9e1eee702632c6c352e591e316527837dd4705b7400a1afa8

Contents?: true

Size: 692 Bytes

Versions: 10

Compression:

Stored size: 692 Bytes

Contents

# -*- encoding : utf-8 -*-
module SecondLevelCache
  module ActiveRecord
    module Base
      extend ActiveSupport::Concern

      included do
        after_commit :expire_second_level_cache, :on => :destroy
        after_commit :update_second_level_cache, :on => :update
        after_commit :write_second_level_cache, :on => :create

        class << self
          alias_method_chain :update_counters, :cache
        end
      end


      module ClassMethods
        def update_counters_with_cache(id, counters)
          update_counters_without_cache(id, counters).tap do
            Array(id).each{|i| expire_second_level_cache(i)}
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
second_level_cache-2.1.1 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.0 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.0.rc2 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.0.rc1 lib/second_level_cache/active_record/base.rb
second_level_cache-2.0.0 lib/second_level_cache/active_record/base.rb
second_level_cache-2.0.0.rc1 lib/second_level_cache/active_record/base.rb
second_level_cache-2.0.0.beta lib/second_level_cache/active_record/base.rb
second_level_cache-1.6.2 lib/second_level_cache/active_record/base.rb
second_level_cache-1.6.1 lib/second_level_cache/active_record/base.rb
second_level_cache-1.6.0 lib/second_level_cache/active_record/base.rb