Question 240
Two concurrent Redis refresh workers overwrite a newer product price with an older value during a cache miss race. Which engineering change is the most direct response to the stated failure and constraint?
Explanation
Correct Answer
This remedy fits the observed case: Two concurrent Redis refresh workers overwrite a newer product price with an older value during a cache miss race. Use source versions and conditional compare-and-set or an atomic update policy for stale writes. The underlying issue is Uncoordinated last-writer-wins cache updates allow older data to replace newer data. Direct acceptance evidence is The final cached version never regresses behind a newer committed source version.
Incorrect Answers
Simultaneous expiry sends many duplicate reads to the database. This is a separate requirement; the current case instead hinges on: Uncoordinated last-writer-wins cache updates allow older data to replace newer data. The matching answer is: Use source versions and conditional compare-and-set or an atomic update policy for stale writes.
The alternative addresses: Shared key namespaces mix unrelated environments. The reported constraint here is different: Uncoordinated last-writer-wins cache updates allow older data to replace newer data. The case-specific choice is: Use source versions and conditional compare-and-set or an atomic update policy for stale writes.
TTL-only staleness outlasts acceptable source-change propagation. By contrast, the relevant technical condition here is: Uncoordinated last-writer-wins cache updates allow older data to replace newer data. The appropriate selection is: Use source versions and conditional compare-and-set or an atomic update policy for stale writes.