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(“#recordrecord.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_versionObject



819
820
821
822
# File 'lib/upkeep/runtime.rb', line 819

def cache_key_with_version
  record_upkeep_cache_key_dependency
  super
end