World Congress 2022 β€’ Jun 15, 2022

Event based cache invalidation in GraphQL

Simone Sanfratello

Simi San Fratello reveals the ultimate fix for stale GraphQL data. Master true event-based cache invalidation using Redis and Mercurius to keep interactive apps perfectly synchronized.

Pause
Mute Enter Fullscreen
#1 about 3 min

Introduction to GraphQL resolvers and the Mercurius ecosystem

Treating GraphQL resolvers as pure functions provides a foundation for effective memoization.

#2 about 4 min

Balancing time-based expiration and event-based caching strategies

Comparing scheduled expiration against write-event triggers reveals different tradeoffs for data consistency.

#3 about 2 min

Selecting optimal caching approaches based on data volatility

Static reference lists suit scheduled refreshes while live application settings require immediate event updates.

#4 about 4 min

Comparing in-memory and Redis storage for cache scalability

Redis enables shared caching across multiple application instances while in-memory storage serves lightweight repetitive entries.

#5 about 4 min

Targeting cache entries using reference indexes in Mercurius

Linking serialization keys to entity references allows precise cache invalidation upon data writes.

#6 about 7 min

Setting up a baseline GraphQL API in Fastify

Defining schemas and basic resolvers establishes the necessary infrastructure for testing cache implementations.

#7 about 5 min

Configuring default caching policies and storage in Mercurius

Applying specific expiration durations and storage types at the query level isolates caching behaviors.

#8 about 4 min

Implementing event-based cache invalidation for updated mutations

Returning referenced entity identifiers from mutation resolvers successfully clears stale associated records.

#9 about 4 min

Optimizing concurrent requests via asynchronous cache deduplication

Resolving duplicated concurrent requests through shared promises stops redundant database queries under load.

#10 about 4 min

Addressing the N+1 problem and partial query caching

Applying dataloaders at the resolver level prevents severe performance bottlenecks when fetching associated nodes.

Matching moments

5:48 min

Solving data fetching demands with GraphQL

Florian Bader Florian Bader Β· WWC Europe 2026

2:09 min

Mitigating security risks and expensive computational joins in GraphQL

Gregor Bauer Gregor Bauer Β· WWC 2024

1:28 min

Optimizing performance across JSON methodologies and backend stacks

Alen Pokos Β· LIVE

4:51 min

Answering questions on content cache invalidation and storage

Rowdy Rabouw Rowdy Rabouw Β· WWC 2023

4:41 min

Managing content scale and cache invalidation bottlenecks

Kyle Mathews Β· WWC 2022

1:49 min

Exploring the n+1 query problem with naive resolvers

William Lyon Β· LIVE

Upcoming sessions on this topic

Open session

World Congress 2026 North America

KV Cache Is Not About Speed: It's About Surviving Inference Costs

David vonThenen

AI/ML Leader | Keynote Speaker | OSS Engineer & Developer Advocate | Agentic AI, Deep Learning, Production AI | Python, Go, C++

David vonThenen
Open session

World Congress 2026 North America

Testing React Backends Like a Pro: Mocking Databases with SQLite

David Morris

Solution Architect

David Morris
Open session

World Congress 2026 North America

API = Some REST and HTTP, right? RIGHT?!

Rustam Mehmandarov

Passionate computer scientist

Rustam Mehmandarov
Open session

World Congress 2026 North America

How to generate business value through performance optimizations

Nikolai Sidiropulo

Software Engineer at Meta

Nikolai Sidiropulo
Open session

World Congress 2026 North America

public void saveMoney(AI): The Developer's Guide to Unit Economics

Hrushikesh Pokala

Senior Software Engineer Lead at Equifax

Hrushikesh Pokala
Open session

World Congress 2026 North America

Full Stack with Flutter - are we there yet?

Nemanja Stoőić

Senior Flutter Developer

Nemanja Stoőić