Debug a caching bug
Fix stale cache returns by checking TTL settings, missing write invalidation, key collisions, and read/write race conditions.
Preview
Copy prompt
My cache is serving stale data even after the underlying data has changed: [Describe the bug and the data flow]. Here is the caching code: [Paste code]. Diagnose the issue by checking for an incorrectly configured TTL, missing or incorrectly triggered cache invalidation on write operations, cache key collisions due to insufficient key specificity, and race conditions between concurrent read-through and write-through operations. Provide a corrected implementation with explanation.
More
Debugging
Prompts
