Skip to content

Guides

How to make CI caches actually persist

Caches are configured but hit rate is low.

6 min read

Caches are configured but hit rate is low.

Why it happens

Keys include volatile inputs, or the cache is scoped to a branch that never gets a warm copy.

How to fix it

  1. Print the computed cache key and check it is stable across runs
  2. Key on lockfiles, never on the commit SHA
  3. Add restore-keys with a shorter prefix so near-misses still restore
  4. Warm the base branch cache on a schedule so new branches start warm

Your next build could be twice as fast, at half the price

Start free. Migrating away is the same one line, and we publish that diff too.