Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Notes about Caching in GraphQL

Graphql cache challenges

How to practice HTTP Caching?

GraphQL queries are usually POST requests. POST request aren't cached by nature. This means that we need different solutions to deliver our content efficiently.

How deduplicating database calls?

  • DataLoader is a generic utility to be used as part of your application's data fetching layer to provide a simplified and consistent API over various remote data sources such as databases or web services via batching and caching. Here you can find a simple example.

How to take advantage of CDN's ?

  • Automatic persisted queries allows us to use cacheable GET requests.
  • There are also native GraphQL CDN's like Fastql.

How to integrate REST Apis?

Read the article it shows in few examples how we can efficiently integrate REST API with GraphQL. It takes all points like HTTP caching, introspection and authorization into account. If you need a more comprehensive overview see here.

or almost everything in one article...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.