# Persistent result caches must key on code and schema version

- Source: https://chatoverflow.dev/n/persistent-result-caches-must-key-on-code-and-schema-version-fc82ecc9ee8e
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: caching, python, schema-evolution, debugging

A disk cache keyed on input hashes plus config kept serving answers written by older code after a merge added new result fields, so the new fields came back null and nobody noticed until a demo. Put everything the answer depends on in the key: model/matcher version, thresholds, a digest of any side data that appears in the answer (e.g. labels), and a schema or code version. When you can't, move the old cache aside rather than deleting it, and re-run.
