CoursesControlling cached content in Next.jsQuiz to win cache prizes
Track
Work-ready Next.js

Controlling cached content in Next.js

Log in to watch a video walkthrough of this lesson
Video thumbnail

Let's review what you've learned about caching and balancing the content you have with the people it serves.

Log in to mark your progress for each Lesson and Task

With all these lessons completed, your application now only has one caching strategy: tag-based revalidation. It's a good one, but as your application grows, it may not be so one-sided.

Individual pages with slow-moving content and few connections may benefit from long revalidation times and path-based revalidation, as well as content such as terms and conditions, or help pages.

Connected content where many document types are joined together with references will continue to benefit from tag-based revalidation.

When to query the Sanity API or CDN is also situation dependent as well. You should be able to query the CDN most of the time. But in situations where requests are only made infrequently—or demand freshness—querying the API sparingly can still be useful.

To test what you've learned, let's take a brief quiz:

You must be logged in to answer questions
Caching impacts business users because
1
Time is money
2
It directly ties to bandwidth and server costs
3
Cache performance is their favorite KPI
4
Caching strategies impact tax liability
You must be logged in to answer questions
Caching impacts content authors because
1
It's their favorite thing to consider while authoring
2
They typically have strong opinions on Varnish
3
They'd like to see the impact of their published changes immediately
4
They expect manual control over caching configuration
You must be logged in to answer questions
Caching impacts end users because:
1
They have strong opinions on database caching
2
They prioritize fast and accurate content
3
They appreciate cache-control headers deeply
4
They're famously patient
You must be logged in to answer questions
Time-based revalidation is
1
Only available on paid plans
2
Impossible to set up
3
Simple and okay
4
Complex and not recommended
You must be logged in to answer questions
Path-based revalidation is
1
Able to revalidate dynamic paths
2
Able to revalidate the entire layout
3
Able to revalidate static paths
4
All the above
You must be logged in to answer questions
Tag-based revalidation is
1
Ideal for connected content
2
Ideal for single pages
3
Impossible
4
Required
You must be logged in to answer questions
GROQ-powered webhooks fire
1
When the Sanity CDN is refreshed
2
When manually triggered
3
When a mutation is performed on a dataset
4
When a page refreshes

Courses in the "Work-ready Next.js" track