Sha256: 96284632cd79c9423019e8efdc4118aec7724cb9107170d6eedd853a7dd40f58

Contents?: true

Size: 591 Bytes

Versions: 11

Compression:

Stored size: 591 Bytes

Contents

module SecondLevelCache
  module ActiveRecord
    module Base
      def self.prepended(base)
        base.after_commit :expire_second_level_cache, on: :destroy
        base.after_commit :update_second_level_cache, on: :update
        base.after_commit :write_second_level_cache, on: :create

        class << base
          prepend ClassMethods
        end
      end

      module ClassMethods
        def update_counters(id, counters)
          super(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.3.3 lib/second_level_cache/active_record/base.rb
second_level_cache-2.3.2 lib/second_level_cache/active_record/base.rb
second_level_cache-2.3.1 lib/second_level_cache/active_record/base.rb
second_level_cache-2.3.0 lib/second_level_cache/active_record/base.rb
second_level_cache-2.3.0.beta lib/second_level_cache/active_record/base.rb
second_level_cache-2.2.6 lib/second_level_cache/active_record/base.rb
second_level_cache-2.2.5 lib/second_level_cache/active_record/base.rb
second_level_cache-2.2.4 lib/second_level_cache/active_record/base.rb
second_level_cache-2.2.3 lib/second_level_cache/active_record/base.rb
second_level_cache-2.2.2 lib/second_level_cache/active_record/base.rb
second_level_cache-2.2.1 lib/second_level_cache/active_record/base.rb