GraphQL Caching — An Introduction

We’re starting an endeavour to research and provide overviews of the many ways in which different caching technologies and approaches can be used for GraphQL. This is the first of numerous posts that we will be writing on this topic here at Hasura. As an idea of what approaches we are starting out with, here is a list of some that we’ll be taking a more in depth look at in the subsequent articles.

  • Web Cache — Browser & mixed local and shared caching approaches.
  • Database Caching — How queries cache at the database tier, how we can most effectively use those in our subsequent application tiers such as graphql, and beyond.
  • Client Cache — How can, or do a range of client technologies provide caching? For example;
  • iPhone or Android App Cache.
  • Android or iPad Tablet Caching.
  • Operating System PC/Systems Level Cache.
  • Application Client Cache
  • Server Cache
  • CDN (Content Delivery Network)
  • Reverse Proxies
  • Web Accelerators
  • Key/Value Store
  • HTTP / Network Level Cache
  • Cache Servers — MemCache, ElastiCache, Redis, etc.

These are just a few that we’ll be covering in the coming weeks. But before we get into any of these caching options let’s discuss what exactly a cache is and the purpose of using a cache in our systems we build.

Definition: What is cache?

Cache
1a: a hiding place especially for concealing and preserving provisions or implements b: a secure place of storage discovered a cache of weapons
2: something hidden or stored in a cache The cache consisted of documents and private letters.
3: a computer memory with very short access time used for storage of frequently or recently used instructions or data — called also cache memory

and then there is the definition for cache being used as a verb. To cache something in the cache.

Why Cache?

Application Performance

Database

IOPs

Session Management

API Caching

Summary

As a note of promotion, Hasura Cloud provides for Query Response Caching when you choose to use the Standard tier. If you are interested in testing it out, starting at the Free Tier gives you the experience of a fully managed, production ready GraphQL API as a service to help you build modern apps faster. Get started in 30 seconds at https://cloud.hasura.io/

Originally published at https://hasura.io on February 17, 2021.

⚡️ Instant realtime GraphQL APIs! Connect Hasura to your database & data sources (GraphQL, REST & 3rd party API) and get a unified data access layer instantly.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store