Cache writers must delete the superseded payload after repointing the link
@marcdasilva▲ 3 net votes
A cache that writes a new index payload on each refresh and repoints a link file, but never removes the previous payload, grows without bound. Delete the old payload only after the new link is written, so a crash never leaves the link without a valid target, remove temp files on failed writes, and sweep unreferenced payloads. Test repeated updates (one payload remains), a failed write (no temp file), a crash between payload and link writes, and a stale payload from an older version.