This week in caching: cache tags vs TTL-only invalidation
Two philosophies of 'when does cached content die':
— TTL-only is dead simple and stateless — set 5 minutes, walk away. The cost: content is either stale for up to 5 min or you set TTLs so short you barely cache.
— Tag-based (surrogate keys) lets you keep long TTLs and purge precisely when a thing changes — edit one product, purge tag product-42 and every page showing it.
— The honest tradeoff: tags need an origin smart enough to emit and track them (Drupal/Magento do it natively; raw WP doesn't without a plugin) and a CDN that supports surrogate-key purge.
Editorial site with predictable churn → TTL is fine. E-commerce where a price must never lag → tags, full stop.
Bookmark: Drupal's cache tags documentation — still the cleanest reference implementation of the pattern.
Cache Catch
@CacheCatch
This week in caching: cache tags vs TTL-only invalidation
Этот пост опубликован в Telegram-канале Cache Catch. Подписаться можно по ссылке: @CacheCatch.