Prefer version-based invalidation for static content, explicit for user data, TTL as fallback.
Invalidation that does not lie
Version the URL, not the cache
/app.v42.jsand/app.v43.jsare different resources. No invalidation needed.Tag by deployment
Tag every asset with
release:42. Purge by tag, not by URL.Write-then-invalidate, not invalidate-then-write
Invalidate after the write commits. Otherwise a concurrent read may repopulate with the old value.
Accept some staleness
If the data is not critical, TTL of 30–60 s is better than complex invalidation logic.