backend
Receiver-Side Monotonic Expiry
Receiver-Side Monotonic Expiry
The sender transmits a duration, never a timestamp. The receiver starts counting at delivery, so time spent queued doesn't eat the lifetime, and a wrong or hostile sender clock has no effect.
Monotonic clocks don't jump, but their readings mean nothing in another process. Store three things: a random id for the running process, the monotonic reading, and a wall-clock estimate.
same session id → compare monotonic readings only
different id → compare the wall estimate
implausibly far ahead (over 400 days) → expired
any doubt → expired
Also: saturate arithmetic on huge TTLs, treat a pre-epoch clock as expired instead of panicking, and make the clock injectable so tests can fix it. Expiry should be enforced on access and by a periodic sweep that purges payloads, or data outlives its deadline on an idle machine.
Used in: Ferry