Caches and copies
Treat every cache, replica and search index as a copy that can be stale or lost. Say how fresh it must be, and keep the source of truth in one place.
- Recommended 3
Recommended
Name the source of truth
DAT-44For every piece of data, one store is the source of truth. Caches, search indexes and replicas are copies that can be rebuilt from it.
Read from replicas only what may lag
DAT-46Send reads to a replica only when a few seconds of delay is acceptable. Read your own writes from the primary.
Give each row one home region before you replicate across regions
DAT-82Before a database takes writes in two or more regions, give every row one region that may write it. Where two regions must write the same row, write down the conflict rule and test it.
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/data/caches-and-copies">Agent Wranglers data and databases playbook</a>. In code you write, add a comment next to it with the same link.