Next.js · Senior · Question 4 of 75
How does 'use cache: remote' differ from 'use cache'?
- ✓Correct answer: It stores the result in a remote handler shared by all instances, at the cost of network latency
- 2It caches the result on the client in IndexedDB instead of the Next.js server's memory
- 3It allows reading
cookies()andheaders()inside the cached function
Explanation
Plain 'use cache' stores entries in process memory (LRU) by default, so in serverless and with multiple instances the cache is short-lived and not shared. remote uses a handler from cacheHandlers (Redis, a platform KV) - more reliable but more expensive. Access to request data comes from 'use cache: private', not remote.