Next.js · Senior · Question 58 of 75
Where do you plug in a shared cache store (e.g. Redis) for 'use cache' when self-hosting?
- ✓Correct answer: The
cacheHandlersoption innext.configwith a custom handler implementation - 2Set
REDIS_URLand Next.js detects it automatically - 3Wrap every function in
unstable_cache
Explanation
Custom handlers let several instances share 'use cache' / 'use cache: remote' entries and tag invalidation instead of each pod keeping its own memory cache.