---
title: "Caches and copies · Agent Wranglers"
url: https://agentwranglers.se/playbook/data/caches-and-copies
updated: 2026-10-20
licence: "All rights reserved"
---

# Caches and copies

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

> 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.

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers data playbook: https://agentwranglers.se/playbook/data/caches-and-copies`.

## Required

- [Name the source of truth](https://agentwranglers.se/playbook/data/caches-and-copies/source-of-truth): For every piece of data, one store is the source of truth. Caches, search indexes and replicas are copies that can be rebuilt from it.
- [Decide how stale a cache may be](https://agentwranglers.se/playbook/data/caches-and-copies/cache-freshness): Give every cached value an expiry or an invalidation rule, chosen for how stale it may safely be.

## Recommended

- [Read from replicas only what may lag](https://agentwranglers.se/playbook/data/caches-and-copies/replica-lag): Send reads to a replica only when a few seconds of delay is acceptable. Read your own writes from the primary.
- [Keep search indexes in step](https://agentwranglers.se/playbook/data/caches-and-copies/search-index-sync): Update the search index from the source of truth through a reliable queue, and rebuild it fully on a schedule.

- Previous: [Operations](https://agentwranglers.se/playbook/data/operations)
- [All chapters](https://agentwranglers.se/playbook/data)
