Simone Sanfratello
Event based cache invalidation in GraphQL
#1about 2 minutes
Understanding GraphQL resolvers as cacheable functions
GraphQL resolvers can be treated as pure functions, allowing their results to be memoized and cached based on query arguments.
#2about 5 minutes
Comparing time-based and event-based cache invalidation
Time-based invalidation is simple but can serve stale data, whereas event-based invalidation keeps data synced but is more complex to implement.
#3about 4 minutes
Choosing a storage backend and generating cache keys
A cache can use fast in-memory storage for small, frequent data or a shared Redis instance for larger datasets across multiple nodes.
#4about 4 minutes
Using references for targeted cache invalidation
By tagging cache entries with references to the underlying data entities, you can precisely invalidate them when a write event occurs.
#5about 7 minutes
Live demo of setting up a basic GraphQL server
A Fastify server is configured with the Mercurius plugin to serve a GraphQL schema with user and country data from an in-memory database.
#6about 3 minutes
Live demo of implementing a time-based cache policy
The Mercurius Cache plugin is configured with a time-to-live policy for a query, using onHit and onMiss events to verify its effectiveness.
#7about 5 minutes
Live demo of solving stale data with event invalidation
An invalidation function is added to a mutation resolver, which uses references to clear the relevant user data from the cache upon update.
#8about 3 minutes
Exploring advanced features of Mercurius Cache
Mercurius Cache also supports custom key generation, request deduplication, programmatic invalidation with wildcards, and garbage collection for references.
#9about 4 minutes
Q&A on career advice and GraphQL best practices
Common GraphQL pitfalls are discussed, such as neglecting to use DataLoaders to solve the N+1 query problem.
Related jobs
Jobs that call for the skills explored in this talk.
Matching moments
35:10 MIN
Using frameworks for automatic cache invalidation
How Gatsby Cloud's real-time streaming architecture drives <5 second builds
32:15 MIN
Q&A on cache strategies and dynamic content
Offline first!
17:32 MIN
Addressing GraphQL security and implementation challenges
GraphQL: Does it replace SQL, REST or Something Else?
25:30 MIN
Keeping cached data fresh with CDN invalidation
Accelerating Authentication Architecture: Taking Passwordless to the Next Level
13:39 MIN
Implementing frontend caching in React Native apps
Optimizing Your App for Success: Tips and Techniques for managing slow devices
44:31 MIN
Q&A on GraphQL, team structure, and vendor software
Building high performance and scalable architectures for enterprises
32:34 MIN
Q&A on caching strategies and implementation details
Advanced Caching Patterns used by 2000 microservices
10:26 MIN
How GraphQL improves upon REST's limitations
REST in Peace? What does the API protocol of the future look like? Or do we have it already?
Featured Partners
Related Videos
GraphQL: Does it replace SQL, REST or Something Else?
Gregor Bauer
Putting the Graph In GraphQL With The Neo4j GraphQL Library
William Lyon
Advanced Caching Patterns used by 2000 microservices
Natan Silnitsky
Things I learned while writing high-performance JavaScript applications
Michele Riva
HTTP headers that make your website go faster
Thijs Feryn
In-Memory Computing - The Big Picture
Markus Kett
Maximising Cassandra's Potential: Tips on Schema, Queries, Parallel Access, and Reactive Programming
Hartmut Armbruster
GraphQL + Apollo + Next.js: A Lovely Trio
Josh Goldberg
Related Articles
View all articles


.webp?w=240&auto=compress,format)
From learning to earning
Jobs that call for the skills explored in this talk.

Senior Backend Developer - AWS/Node - (f/m/x)
doinstruct Software GmbH
Berlin, Germany
Intermediate
Senior
Node.js

Lead Backend Engineer (m/f/d)
Peter Park System GmbH
München, Germany
Senior
Python
Docker
Node.js
JavaScript


Backend Engineer (TypeScript - Cloudflare Workers, TimescaleDB )
nono
€75-120K
Intermediate
Node.js
Grafana
GraphQL
Terraform
+7

Backend Engineer (TypeScript - Cloudflare Workers, TimescaleDB & AI Infrastructure)
nono
€75-120K
Intermediate
Node.js
Grafana
GraphQL
Terraform
+7

Proficient Software Engineer - Node - React - GraphQL
Atolls
Berlin, Germany
NoSQL
Vue.js
NestJS
Node.js
GraphQL
+3

Proficient Software Engineer - Node - React - GraphQL
Atolls
Munich, Germany
NoSQL
Vue.js
NestJS
Node.js
GraphQL
+3
![Senior Backend Engineer (TypeScript) [Prisma Postgres]](https://wearedevelopers-staging.imgix.net/staging/public/default-job-listing-cover.png?w=400&ar=3.55&fit=crop&crop=entropy&auto=compress,format)
Senior Backend Engineer (TypeScript) [Prisma Postgres]
Prisma Data, Inc.
Remote
Senior
NoSQL
Node.js
GraphQL
PostgreSQL
+1
![Senior Backend Engineer (TypeScript) [Prisma Postgres]](https://wearedevelopers-staging.imgix.net/staging/public/default-job-listing-cover.png?w=400&ar=3.55&fit=crop&crop=entropy&auto=compress,format)
Senior Backend Engineer (TypeScript) [Prisma Postgres]
Prisma Data, Inc.
Remote
Senior
NoSQL
Node.js
GraphQL
PostgreSQL
+1