Module: Upkeep::Runtime::CacheKeyObserver
- Defined in:
- lib/upkeep/runtime.rb
Overview
Hooks cache_key_with_version so that any caller (Rails fragment caching,
Rails.cache.fetch("#{record.cache_key_with_version}/..."), Russian doll,
etc.) registers a dependency on the record's updated_at attribute. This
lets Upkeep stay reactive across Rails.cache.fetch blocks: even on cache
hits, the participating records are still declared as dependencies, so a
touch/update broadcasts an update to subscribers viewing the cached
fragment.
Instance Method Summary collapse
Instance Method Details
#cache_key_with_version ⇒ Object
856 857 858 859 |
# File 'lib/upkeep/runtime.rb', line 856 def cache_key_with_version record_upkeep_cache_key_dependency super end |