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 · World Congress 2026 Europe

2:09 min

Mitigating security risks and expensive computational joins in GraphQL

Gregor Bauer Gregor Bauer · World Congress 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 · World Congress 2023

1:49 min

Exploring the n+1 query problem with naive resolvers

William Lyon · LIVE

4:28 min

Mitigating Redis hot keys with origin shield protection

Yedidya Schwartz · LIVE

Upcoming sessions on this topic

Open session

World Congress 2026 North America

September 24, 2026 · 15:30–16:00

Stage 2

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

September 25, 2026 · 16:10–16:40

Stage 4

Speed up your CI/CD pipelines by caching build & runtime artifacts

Thijs Feryn

Technical Evangelist at Varnish Software

Thijs Feryn
Open session

World Congress 2026 North America

September 24, 2026 · 10:20–10:50

Stage 5

Vector, Graph, or Key Value? Choosing Your Agent's Memory

Elizabeth Fuentes Leone

AWS - Developer Advocate/SDE, GenAI

Elizabeth Fuentes Leone
Open session

World Congress 2026 North America

September 25, 2026 · 10:20–10:50

Stage 9

Testing React Backends Like a Pro: Mocking Databases with SQLite

David Morris

Solution Architect at Leidos

David Morris
Open session

World Congress 2026 North America

September 25, 2026 · 10:20–10:50

Stage 2

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

Rustam Mehmandarov

Passionate computer scientist

Rustam Mehmandarov
Open session

World Congress 2026 North America

September 24, 2026 · 14:50–15:20

Stage 9

How to generate business value through performance optimizations

Nikolai Sidiropulo

Software Engineer at Meta

Nikolai Sidiropulo