Hey everyone!,
In this video, we’re diving deep into how caching works in Next.js. I’ll walk you through the four main caching layers: Request Memoization, the Data Cache, Full Route Cache, and the client-side Router Cache. Each one plays a different role in performance, and by the end, you’ll understand exactly how they work and when to use them.
All code examples from the video are on GitHub:
github.com/stevef24/Nextjs-cache
This channel is all about making frontend and AI topics easier to learn. I believe education should be free, so I’ll keep making videos like this to share what I learn and provide as much value as possible.
If you find this helpful and want to support future videos, you can buy me a coffee:
buymeacoffee.com/stavf24
I also mention the “stale-while-revalidate” pattern — it’s a key part of how data caching works behind the scenes. If you want to dig deeper:
web.dev/articles/stale-while-revalidate
Timestamps:
00:00:00 - 00:00:20 Intro
00:00:20 - 00:01:19 Request Memoization Explained
00:01:19 - 00:02:46 Request Memoization Visual Flow
00:02:46 - 00:03:28 Memoization Details (Duration, Revalidation, Opting Out)
00:03:28 - 00:07:00 Memoization Code Demo
00:07:00 - 00:07:28 Data Cache Explained
00:07:28 - 00:08:55 Force Cache vs No Store Flow
00:08:55 - 00:09:43 Data Cache Revalidation Options
00:09:43 - 00:11:21 Time-Based Revalidation Flow
00:11:21 - 00:12:32 On-Demand Revalidation (Cache Tags)
00:12:32 - 00:16:39 Data Cache Code Demo
00:16:39 - 00:16:57 Full Route Cache Explained
00:16:57 - 00:17:59 What Happens During Build
00:17:59 - 00:19:17 Static vs Dynamic Routes
00:19:17 - 00:20:33 Duration and Invalidation
00:20:33 - 00:23:31 Full Route Cache Code Demo
00:23:31 - 00:24:36 Client-Side Router Cache Explained
00:24:36 - 00:26:12 Router Cache Details (Duration, Invalidation, Opting Out)
00:26:12 - 00:28:02 Router Cache Code Demo
00:28:02 - 00:28:31 Outro
コメント