Stateless application instances store shopping carts in DynamoDB, where concurrent edits must not silently overwrite one another and expired carts must immediately reject updates. Each cart has a version and expiration timestamp, with TTL enabled for cleanup; which update strategy meets these requirements?
Show the answer
Correct answerB. Condition updates on the expected version and unexpired timestamp, incrementing the version atomically
AWhy not this: TTL cleanup is asynchronous, so an expired cart can remain present and accept an update.
BWhy this is right: The atomic conditions enforce concurrency control and expiration, while the version increment invalidates stale edits.
CWhy not this: Another writer can change the cart between the read and the unconditional write, causing a lost update.
DWhy not this: An instance-local lock does not coordinate edits handled by other instances.
A conditional update checks the version and expiration atomically, rejecting stale edits and expired carts without instance-local state. Version checking alone is insufficient because DynamoDB TTL deletion is asynchronous.