Sha256: e5169527131389c3b3c9ed29d0bc15da9d344d314e160de83dd70208041f2b3f

Contents?: true

Size: 851 Bytes

Versions: 2

Compression:

Stored size: 851 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)
        update_column_without_second_level_cache(name, value).tap{update_second_level_cache}
      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)
        touch_without_second_level_cache(name).tap{update_second_level_cache}
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
second_level_cache-2.1.1 lib/second_level_cache/active_record/persistence.rb
second_level_cache-2.1.0 lib/second_level_cache/active_record/persistence.rb