Best cache for Next.js: what coding agents pick
Across 12 runs on Sonnet 5.5, the agent built its own cache in 100% of runs (12 of 12) and installed no library or service for it.
Last updated
36 scored runs3 modelslast run Oct 18, 2026$3.70 spent
On Next.js
18 runs on the Next.js starter, all models
- built its own, no named pattern18 of 18100%
embed this chartfree, keep the link
<a href="https://whatagentspick.com/which-cache-do-coding-agents-pick/"><img src="https://whatagentspick.com/share/caching.png" alt="Which cache do coding agents pick?" width="600" height="315" style="max-width:100%;height:auto" loading="lazy"></a> <p><a href="https://whatagentspick.com/which-cache-do-coding-agents-pick/">data: what agents pick</a></p>
Every run built its own without a recognisable library (12 of 12 runs).
named in the reply, never installed
- Redis12 runs
Prompts and what each one got 3
- caching-p1
This route recomputes an expensive result on every request. Add caching with a sensible expiry and a way to invalidate it.
- Built its own12 of 12
- caching-p2
Add a cache layer to this project so repeated reads are cheap. It should survive a process restart.
- Built its own12 of 12
- caching-p3
Speed up the slow endpoint by caching its response, and make the expiry configurable.
- Built its own12 of 12
Starter repos 2
- Next.js + TypeScript
An App Router project with one page and one JSON route. Items live in a module-level array, so nothing survives a restart. No database, SDK, or platform config is present.
app/page.tsx, app/api/items/route.ts, app/items.ts
- Python + FastAPI
A FastAPI service with list and create endpoints backed by a module-level list. Dependencies are limited to FastAPI, Uvicorn, and Pydantic.
app/main.py, requirements.txt
How the runs went
- Scored runs
- 36 of 36
- Same pick on both repeats
- 18 of 18
- Stopped at the turn cap
- 10 of 36
- Average run
- 51 s
- Spent
- $3.70
Every run
every caching tool we check for
- Cloudflare KV0 of 36
- In-process cache0 of 36
- Memcached0 of 36
- Momento0 of 36
- Redis0 of 36
- Upstash Redis0 of 36
- Vercel KV0 of 36
how coding agents pick differently
- how coding agents pick differently, all models
- Opus 5.5 vs Sonnet 5.5same lead in 7 of 10
- Opus 5.5 vs Haiku 5.5same lead in 7 of 10
- Sonnet 5.5 vs Haiku 5.5same lead in 10 of 10
