1 Commits
Author SHA1 Message Date
ubuntuandClaude Opus 5.5 c2947bed32 perf(cache): size-capped SQLite cache handler instead of per-file ISR cache
The default Next.js cache writes one file per rendered page and per fetch
and never evicts. With on-demand movie/person/tv pages and crawlers walking
the sitemap, it grew to ~3.7M files (~80 GB) in 5 days, and deleting them
loaded the whole server.

cache-handler.js keeps the ISR and fetch cache in a single SQLite file
(node:sqlite, no native dependency) and evicts the least recently used
entries once it passes NEXT_CACHE_MAX_MB (default 5 GB), so the cache stays
bounded with no cleanup job. The file lives in the container, so each deploy
starts with a fresh cache that never serves pages from an older build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 07:00:35 +00:00