Module: AdequateSerialization::CacheRefresh

Defined in:
lib/adequate_serialization/rails/cache_refresh.rb

Defined Under Namespace

Classes: CacheRefreshJob

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



46
47
48
# File 'lib/adequate_serialization/rails/cache_refresh.rb', line 46

def self.extended(base)
  base.after_update_commit { CacheRefreshJob.perform_later(self) }
end

Instance Method Details

#associate_cache(association) ⇒ Object



50
51
52
# File 'lib/adequate_serialization/rails/cache_refresh.rb', line 50

def associate_cache(association)
  associated_caches << association
end

#associated_cachesObject

The associations that serialize this object in their responses, so that we know to bust their cache when this object is updated.



56
57
58
# File 'lib/adequate_serialization/rails/cache_refresh.rb', line 56

def associated_caches
  @associated_caches ||= []
end