Skip to content

[next@15] use-cache not persisted #2694

Open
@pieh

Description

@pieh

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 with experimental.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 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions