GraphQL Caching Cheat Sheet

Cache layers, TTLs, and invalidation

Last Updated: November 21, 2025

Caching Layers

Layer Approach
Browser Apollo cache
Edge CDN with cache keys
Server In-memory TTL

Commands

cacheControl: { maxAge: 60 }
Serve fresh data
dataloader.loadMany(ids)
Batch & cache DB calls
invalidate cache key
When writes occur

Strategy

Combine short TTLs with manual invalidation for writes and document staleable fields.

💡 Pro Tip: Use Dataloader for per-request caching and cache directives for shared layers.
← Back to Databases & APIs | Browse all categories | View all cheat sheets