GraphQL and caching - Why is it so hard, or is it?
summary
Claim: GraphQL lacks native HTTP caching but is practical if requests expose stable identifiers and use GET or persisted queries. Implements: GET with query in URL, persisted queries, and the global ID/node pattern for cache keys. Notes on limits: ETag or lastModified must cover entire query so single-field changes often invalidate whole responses. Demo uses Airtable + Netlify and Stellate as a cache proxy and shows latency dropping from ~200 ms to ~29 ms on a tiny API.
AI-written summary · about
chapters (11)
- 0:00Introduction to GraphQL caching
- 1:25What is GraphQL and caching
- 3:18Why caching matters in GraphQL
- 4:43GraphQL and HTTP caching limits
- 8:59Using GET requests for GraphQL caching
- 13:56Challenges with GraphQL cache invalidation
- 16:04Globally unique IDs in GraphQL
- 18:42Node pattern for object identification
- 20:26Server-side caching in GraphQL
- 20:46Outsourcing GraphQL caching with Stellate
- 23:58Summary and conclusion
related talks
37mCaching Deep Dive: The Ultimate Way To Speed up Your GraphQL API
23mHow to Edge Cache GraphQL APIs
24mGraphQL Clients
21mCaching GraphQL APIs
24mHow to cache GraphQL queries at the edge
23mHow to edge cache GraphQL APIs
12mHow @Defer and @Stream Will Improve GraphQL Caching
30mWhy GraphQL vs. Why not GraphQL
