Keep data and validator together
HTTP supports ETag and conditional reads. A 304 response is not a fresh replacement body. The sample values below are synthetic opaque tags; do not strip quotes or infer a business revision by parsing them.
| Stored state | Request/response | Handling |
|---|---|---|
| Body A plus ETag "v-a" | If-None-Match: "v-a" → 304 | Reuse matching stored A under cache rules |
| Body A plus ETag "v-a" | 200 with body B and "v-b" | Replace body and validator together |
| Validator present, body missing | 304 received | Recover with a full authorised read |
Invalidate after the relevant write
Decide which representations a write affects: a record view, list membership and derived totals may all differ. Standard HTTP cache behaviour does not automatically invalidate every application-side derived cache. Test an edit followed by detail and list reads.
Can the client display an empty object after 304 when the original body was evicted?
Show the worked answer
No. The validator alone is not the representation. Perform a supported full read and restore a consistent data/validator pair.