Cache Design: Invalidation Strategy First
Give key names, expiry, and when to update
Prompt
Copy it whole, then replace the brackets with your own contentHandle this coding task: Cache Design: Invalidation Strategy First. Code/error: [paste] Environment: [language/version/framework] Requirements: Cover key names, TTL, and when to refresh. Give the diagnosis first, then the changes, then how to verify.
Replace the text in [ ] with your own situation; ask long tasks in stages.
How to get better results
Read this before you fill it inUse when you added caching but data is occasionally inconsistent.
Give the conclusion and impact scope first, then only the changed snippets (no full files), and finally one check that proves it works. Flag risky spots separately.
Product prices are cached for 5 minutes; after a price change in the admin, the storefront sometimes still shows the old price. Using Redis.
Saying only "cache inconsistency" with no update path No expiry policy, so the plan cannot ship Ignoring concurrent writes, so it recurs after the fix
If problems remain after the fix, paste the new error and the changed snippet back; keep debugging on the original approach, don't switch approaches and rewrite.
More like this: Writing code prompts · All prompts