Reference notes on storage engines, HTTP caching, and service reliability.

Implementing idempotency keys without distributed locks

HTTP & Caching

Retrying a timed-out POST request is only safe when the server recognizes the duplicate intent. Storing the idempotency key in the same database transaction as the domain mutation eliminates split-brain windows.

Hash the authenticated caller identity together with the client-supplied key and a request payload digest. Returning a clear conflict error when the same key is reused with different parameters catches client bugs early.

Retain completed response snapshots for twenty-four hours so late retries receive the original status code and body without re-executing side effects.

Prune expired keys incrementally in small indexed batches to avoid long vacuum pauses on busy tables.