
The original title is about three caching pitfalls in a dashboard. Let me rewrite this for a mobile feed.
Original: Three pitfalls in a dashboard cache lifetime — boot-time restore, TTL, and partial invalidation
Short summary
A developer shares three real-world caching pitfalls encountered in a dashboard: badges vanishing on refresh because cache restoration was tied to dashboard open instead of app boot, a 7-day TTL proving too short for actual usage patterns, and maintenance on one site wiping badges for all sites due to unscoped cache invalidation. Fixes include restoring cache at DOMContentLoaded, extending TTL to 30 days with freshness indicators, and implementing partial invalidation scoped to executed site IDs. The underlying lesson is that cache lifetime decisions must account for all consumers and execution scopes, not just the original design intent.
- •Restore persistent caches at app boot, not at first consumer's render time
- •Pair long TTLs with explicit freshness signals like 'fetched N days ago' rather than cutting TTL shorter
- •Scope cache invalidation to the specific execution context — never wipe everything when only a subset changed
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



