Sha256: 32d8edd210a13a13859d823e5fb374490a096e1f8724be72c82dec9e26ecdafe

Contents?: true

Size: 857 Bytes

Versions: 3

Compression:

Stored size: 857 Bytes

Contents

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

      included do
        class_eval do
          alias_method_chain :reload, :second_level_cache
          alias_method_chain :touch, :second_level_cache
          alias_method_chain :update_column, :second_level_cache
        end
      end

      def update_column_with_second_level_cache(name, value)
        expire_second_level_cache
        update_column_without_second_level_cache(name, value)
      end

      def reload_with_second_level_cache(options = nil)
        expire_second_level_cache
        reload_without_second_level_cache(options)
      end

      def touch_with_second_level_cache(name = nil)
        expire_second_level_cache
        touch_without_second_level_cache(name)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
second_level_cache-1.5.1 lib/second_level_cache/active_record/persistence.rb
second_level_cache-1.5.0 lib/second_level_cache/active_record/persistence.rb
second_level_cache-1.3.2 lib/second_level_cache/active_record/persistence.rb