Default implementation relies on in-memory cache so for some cases it might seem like it is working - but this cache lives only as long as lambda instance and if lambda instances are scaled they all each have their own ~local caches.
This is different than using unstable_cache which seems to rely on fetch-cache instead which is actually properly persisted right now.
Do note that use-cache is only allowed when dynamicIO experimental feature is enabled - and that can't even be enabled with stable next@15 versions (at least at the time of creating this issue - so not possible on 15.0.0 and 15.0.1)
Data
The following is parsed automatically by the Next.js repo e2e test report generator.
test: test/e2e/app-dir/use-cache/use-cache.test.ts, test/e2e/app-dir/use-cache-route-handler-only/use-cache-route-handler-only.test.ts
reason: use-cache not persisted
use-cache
uses different CacheHandler than full page cache, fetch-cache etc - by default it uses https://github.com/vercel/next.js/blob/canary/packages/next/src/server/lib/cache-handlers/default.ts but this can be configured withexperimental.cacheHandlers.default
(?)next.config.js
option to use custom implementation.Default implementation relies on in-memory cache so for some cases it might seem like it is working - but this cache lives only as long as lambda instance and if lambda instances are scaled they all each have their own ~local caches.
This is different than using
unstable_cache
which seems to rely onfetch-cache
instead which is actually properly persisted right now.Do note that
use-cache
is only allowed whendynamicIO
experimental feature is enabled - and that can't even be enabled with stable next@15 versions (at least at the time of creating this issue - so not possible on15.0.0
and15.0.1
)Data
The following is parsed automatically by the Next.js repo e2e test report generator.
test: test/e2e/app-dir/use-cache/use-cache.test.ts, test/e2e/app-dir/use-cache-route-handler-only/use-cache-route-handler-only.test.ts reason: use-cache not persisted