Module: RecordCache::InstanceMethods

Defined in:
lib/record_cache.rb

Instance Method Summary collapse

Instance Method Details

#attr_was(attr) ⇒ Object



53
54
55
56
# File 'lib/record_cache.rb', line 53

def attr_was(attr)
  attr = attr.to_s
  ['id', 'type'].include?(attr) ? send(attr) : send(:attribute_was, attr)
end

#complete_deferred_record_cache_invalidationsObject



47
48
49
50
51
# File 'lib/record_cache.rb', line 47

def complete_deferred_record_cache_invalidations
  self.class.each_cached_index do |index|
    index.complete_deferred
  end
end

#invalidate_record_cacheObject



33
34
35
36
37
38
# File 'lib/record_cache.rb', line 33

def invalidate_record_cache
  self.class.each_cached_index do |index|
    index.invalidate_model(self) 
    index.clear_deferred
  end
end

#invalidate_record_cache_deferredObject



40
41
42
43
44
45
# File 'lib/record_cache.rb', line 40

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