module RecordCache::InstanceMethods

Public Instance Methods

attr_was(attr) click to toggle source
# File lib/record_cache.rb, line 54
def attr_was(attr)
  attr = attr.to_s
  if ['id', 'type'].include?(attr) or not attribute_changed?(attr)
    read_attribute(attr)
  else
    changed_attributes[attr]
  end
end
complete_deferred_record_cache_invalidations() click to toggle source
# File lib/record_cache.rb, line 48
def complete_deferred_record_cache_invalidations
  self.class.each_cached_index do |index|
    index.complete_deferred
  end
end
invalidate_record_cache() click to toggle source
# File lib/record_cache.rb, line 34
def invalidate_record_cache
  self.class.each_cached_index do |index|
    index.invalidate_model(self)
    index.clear_deferred
  end
end
invalidate_record_cache_deferred() click to toggle source
# File lib/record_cache.rb, line 41
def invalidate_record_cache_deferred
  self.class.each_cached_index do |index|
    # Have to invalidate both before and after commit.
    index.invalidate_model(self)
  end
end