lib/kasket/write_mixin.rb in kasket-0.8.1 vs lib/kasket/write_mixin.rb in kasket-0.8.2

- old
+ new

@@ -2,22 +2,22 @@ module WriteMixin module ClassMethods def remove_from_kasket(ids) Array(ids).each do |id| - Rails.cache.delete(kasket_key_for_id(id)) + Kasket.cache.delete(kasket_key_for_id(id)) end end def update_counters_with_kasket_clearing(*args) remove_from_kasket(args[0]) update_counters_without_kasket_clearing(*args) end def transaction_with_kasket_disabled(*args) - without_kasket do - transaction_without_kasket_disabled(*args) { yield } + without_kasket do + transaction_without_kasket_disabled(*args) { yield } end end end module InstanceMethods @@ -25,11 +25,11 @@ @kasket_key ||= new_record? ? nil : self.class.kasket_key_for_id(id) end def store_in_kasket if !readonly? && kasket_key - Rails.cache.write(kasket_key, @attributes.dup) + Kasket.cache.write(kasket_key, @attributes.dup) end end def kasket_keys attribute_sets = [attributes.symbolize_keys] @@ -52,11 +52,11 @@ keys end def clear_kasket_indices kasket_keys.each do |key| - Rails.cache.delete(key) + Kasket.cache.delete(key) end end def reload_with_kasket_clearing(*args) Kasket.clear_local @@ -70,14 +70,15 @@ model_class.after_save :clear_kasket_indices model_class.after_destroy :clear_kasket_indices model_class.alias_method_chain :reload, :kasket_clearing - + class << model_class alias_method_chain :transaction, :kasket_disabled alias_method_chain :update_counters, :kasket_clearing end end end end +