Sha256: 3eea1050ac90baf79fe66d5ab28f1ef266aad824d4d48419c7cd12423b3d42af

Contents?: true

Size: 572 Bytes

Versions: 2

Compression:

Stored size: 572 Bytes

Contents

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

      included do
        after_destroy :expire_second_level_cache
        after_save :expire_second_level_cache

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


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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
second_level_cache-1.5.1 lib/second_level_cache/active_record/base.rb
second_level_cache-1.5.0 lib/second_level_cache/active_record/base.rb