Sha256: cd18c6fdc6a513cc19fb9dfb40a8382eb10c643dcc6ac3aa86d6106e33c066a4

Contents?: true

Size: 692 Bytes

Versions: 11

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

11 entries across 11 versions & 1 rubygems

Version Path
second_level_cache-2.1.16 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.15 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.14 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.13 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.10 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.9 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.8 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.7 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.6 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.5 lib/second_level_cache/active_record/base.rb
second_level_cache-2.1.2 lib/second_level_cache/active_record/base.rb