@trieb.work/nextjs-turbo-redis-cache 1.18.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +27 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -1
- package/.cursor/skills/testing/SKILL.md +0 -121
- package/.github/workflows/ci.yml +0 -309
- package/.github/workflows/pages.yml +0 -38
- package/.github/workflows/release.yml +0 -58
- package/.prettierrc.json +0 -6
- package/.vscode/settings.json +0 -10
- package/ARCHITECTURE.md +0 -470
- package/commitlint.config.cjs +0 -4
- package/docker/redis.conf +0 -1
- package/docs/index.html +0 -140
- package/docs/robots.txt +0 -4
- package/docs/sitemap.xml +0 -8
- package/docs/styles.css +0 -141
- package/eslint.config.mjs +0 -26
- package/hooks/commit-msg +0 -10
- package/hooks/pre-commit +0 -11
- package/playwright.config.ts +0 -18
- package/release.config.cjs +0 -12
- package/scripts/prepare.sh +0 -7
- package/scripts/setup-git.sh +0 -8
- package/scripts/setup-repo-name.sh +0 -17
- package/scripts/vitest-run-staged.cjs +0 -44
- package/src/CacheComponentsHandler.ts +0 -597
- package/src/CachedHandler.ts +0 -53
- package/src/DeduplicatedRequestHandler.ts +0 -110
- package/src/RedisStringsHandler.ts +0 -949
- package/src/SyncedMap.ts +0 -496
- package/src/ZodHandler.ts +0 -45
- package/src/index.ts +0 -23
- package/src/serializer.ts +0 -59
- package/src/utils/cacheTtl.ts +0 -71
- package/src/utils/compareAndUnlink.ts +0 -29
- package/src/utils/debug.ts +0 -30
- package/src/utils/json.ts +0 -49
- package/src/utils/prefix.ts +0 -44
- package/src/utils/redisConnection.ts +0 -17
- package/src/utils/tagRevalidation.ts +0 -162
- package/test/README.md +0 -194
- package/test/nextjs-test-projects/next-app-15-4-11/README.md +0 -36
- package/test/nextjs-test-projects/next-app-15-4-11/eslint.config.mjs +0 -16
- package/test/nextjs-test-projects/next-app-15-4-11/next.config.js +0 -9
- package/test/nextjs-test-projects/next-app-15-4-11/package-lock.json +0 -5969
- package/test/nextjs-test-projects/next-app-15-4-11/package.json +0 -29
- package/test/nextjs-test-projects/next-app-15-4-11/pnpm-lock.yaml +0 -3726
- package/test/nextjs-test-projects/next-app-15-4-11/postcss.config.mjs +0 -5
- package/test/nextjs-test-projects/next-app-15-4-11/public/file.svg +0 -1
- package/test/nextjs-test-projects/next-app-15-4-11/public/globe.svg +0 -1
- package/test/nextjs-test-projects/next-app-15-4-11/public/next.svg +0 -1
- package/test/nextjs-test-projects/next-app-15-4-11/public/vercel.svg +0 -1
- package/test/nextjs-test-projects/next-app-15-4-11/public/window.svg +0 -1
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/cached-static-fetch/route.ts +0 -18
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/revalidatePath/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/revalidateTag/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/revalidated-fetch/route.ts +0 -17
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/api/uncached-fetch/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/layout.tsx +0 -59
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/no-fetch/default-page/page.tsx +0 -55
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-15-4-11/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-15-4-11/tsconfig.json +0 -27
- package/test/nextjs-test-projects/next-app-16-0-11/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-0-11/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-0-11/next.config.ts +0 -10
- package/test/nextjs-test-projects/next-app-16-0-11/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-0-11/pnpm-lock.yaml +0 -4163
- package/test/nextjs-test-projects/next-app-16-0-11/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/cached-static-fetch/route.ts +0 -18
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/revalidatePath/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/revalidateTag/route.ts +0 -20
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/revalidated-fetch/route.ts +0 -17
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/api/uncached-fetch/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/layout.tsx +0 -59
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/no-fetch/default-page/page.tsx +0 -55
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-0-11/src/app/update-tag-test/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-0-11/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/cache-handler.js +0 -3
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/next.config.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/pnpm-lock.yaml +0 -4206
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/public/file.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/public/globe.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/public/next.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/public/vercel.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/public/window.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/cached-static-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/cached-with-cachelife/route.ts +0 -24
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/cached-with-tag/route.ts +0 -21
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/expire-matrix/revalidate/route.ts +0 -34
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/expire-matrix/route.ts +0 -23
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/revalidate-tag/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/api/revalidated-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/cachelife-short/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/page.tsx +0 -112
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/revalidate-durations/page.tsx +0 -106
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/runtime-data-suspense/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/stale-while-revalidate/page.tsx +0 -130
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/tag-invalidation/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/use-cache-nondeterministic/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/use-cache-remote/page.tsx +0 -85
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/layout.tsx +0 -57
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/update-tag-test/page.tsx +0 -22
- package/test/nextjs-test-projects/next-app-16-0-11-cache-components/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-16-2-6/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-2-6/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-2-6/next.config.ts +0 -7
- package/test/nextjs-test-projects/next-app-16-2-6/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-2-6/pnpm-lock.yaml +0 -4165
- package/test/nextjs-test-projects/next-app-16-2-6/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/cached-static-fetch/route.ts +0 -18
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/revalidatePath/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/revalidateTag/route.ts +0 -20
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/revalidated-fetch/route.ts +0 -17
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/api/uncached-fetch/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/layout.tsx +0 -59
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/no-fetch/default-page/page.tsx +0 -55
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-2-6/src/app/update-tag-test/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-2-6/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/cache-handler.js +0 -3
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/next.config.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/pnpm-lock.yaml +0 -4165
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/public/file.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/public/globe.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/public/next.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/public/vercel.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/public/window.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-static-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-with-cachelife/route.ts +0 -24
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/cached-with-tag/route.ts +0 -21
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/expire-matrix/revalidate/route.ts +0 -34
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/expire-matrix/route.ts +0 -23
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/revalidate-tag/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/api/revalidated-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/cachelife-short/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/page.tsx +0 -112
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/revalidate-durations/page.tsx +0 -106
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/runtime-data-suspense/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/stale-while-revalidate/page.tsx +0 -130
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/tag-invalidation/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/use-cache-nondeterministic/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/cache-lab/use-cache-remote/page.tsx +0 -85
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/layout.tsx +0 -57
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/src/app/update-tag-test/page.tsx +0 -22
- package/test/nextjs-test-projects/next-app-16-2-6-cache-components/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-16-3-0/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-3-0/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-3-0/next.config.ts +0 -7
- package/test/nextjs-test-projects/next-app-16-3-0/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-3-0/pnpm-lock.yaml +0 -4284
- package/test/nextjs-test-projects/next-app-16-3-0/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/cached-static-fetch/route.ts +0 -18
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/nested-fetch-in-api-route/revalidated-fetch/route.ts +0 -27
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/revalidatePath/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/revalidateTag/route.ts +0 -20
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/revalidated-fetch/route.ts +0 -17
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/api/uncached-fetch/route.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/layout.tsx +0 -59
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/cached-static-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/cached-static-fetch/revalidate15--default-page/page.tsx +0 -34
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/cached-static-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/no-fetch/default-page/page.tsx +0 -55
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/revalidated-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/revalidated-fetch/revalidate15--default-page/page.tsx +0 -35
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/revalidated-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/uncached-fetch/default--force-dynamic-page/page.tsx +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/uncached-fetch/revalidate15--default-page/page.tsx +0 -32
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/pages/uncached-fetch/revalidate15--force-dynamic-page/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-3-0/src/app/update-tag-test/page.tsx +0 -25
- package/test/nextjs-test-projects/next-app-16-3-0/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/README.md +0 -36
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/cache-handler.js +0 -3
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/next.config.ts +0 -15
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/package.json +0 -28
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/pnpm-lock.yaml +0 -4284
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/postcss.config.mjs +0 -7
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/public/file.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/public/globe.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/public/next.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/public/vercel.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/public/window.svg +0 -1
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/cached-static-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/cached-with-cachelife/route.ts +0 -24
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/cached-with-tag/route.ts +0 -21
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/expire-matrix/revalidate/route.ts +0 -34
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/expire-matrix/route.ts +0 -23
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/revalidate-tag/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/api/revalidated-fetch/route.ts +0 -19
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/cachelife-short/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/page.tsx +0 -112
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/revalidate-durations/page.tsx +0 -106
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/runtime-data-suspense/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/stale-while-revalidate/page.tsx +0 -130
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/tag-invalidation/page.tsx +0 -127
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/use-cache-nondeterministic/page.tsx +0 -110
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/cache-lab/use-cache-remote/page.tsx +0 -85
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/favicon.ico +0 -0
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/globals.css +0 -26
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/layout.tsx +0 -57
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/page.tsx +0 -755
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/revalidation-interface.tsx +0 -267
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/src/app/update-tag-test/page.tsx +0 -22
- package/test/nextjs-test-projects/next-app-16-3-0-cache-components/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-app-customized/README.md +0 -36
- package/test/nextjs-test-projects/next-app-customized/customized-cache-handler.js +0 -34
- package/test/nextjs-test-projects/next-app-customized/eslint.config.mjs +0 -16
- package/test/nextjs-test-projects/next-app-customized/next.config.js +0 -6
- package/test/nextjs-test-projects/next-pages-16-2-6/README.md +0 -16
- package/test/nextjs-test-projects/next-pages-16-2-6/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-pages-16-2-6/next.config.ts +0 -7
- package/test/nextjs-test-projects/next-pages-16-2-6/package.json +0 -26
- package/test/nextjs-test-projects/next-pages-16-2-6/pnpm-lock.yaml +0 -3896
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/api/revalidate.ts +0 -24
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/index.tsx +0 -11
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/isr/[slug].tsx +0 -49
- package/test/nextjs-test-projects/next-pages-16-2-6/src/pages/static-forever.tsx +0 -20
- package/test/nextjs-test-projects/next-pages-16-2-6/tsconfig.json +0 -34
- package/test/nextjs-test-projects/next-pages-16-3-0/README.md +0 -16
- package/test/nextjs-test-projects/next-pages-16-3-0/eslint.config.mjs +0 -18
- package/test/nextjs-test-projects/next-pages-16-3-0/next.config.ts +0 -7
- package/test/nextjs-test-projects/next-pages-16-3-0/package.json +0 -26
- package/test/nextjs-test-projects/next-pages-16-3-0/pnpm-lock.yaml +0 -3939
- package/test/nextjs-test-projects/next-pages-16-3-0/src/pages/api/revalidate.ts +0 -24
- package/test/nextjs-test-projects/next-pages-16-3-0/src/pages/index.tsx +0 -11
- package/test/nextjs-test-projects/next-pages-16-3-0/src/pages/isr/[slug].tsx +0 -49
- package/test/nextjs-test-projects/next-pages-16-3-0/src/pages/static-forever.tsx +0 -20
- package/test/nextjs-test-projects/next-pages-16-3-0/tsconfig.json +0 -34
- package/test/playwright/cache-lab.spec.ts +0 -232
- package/test/playwright/update-tag.spec.ts +0 -33
- package/test/vitest/integration/build-id-prefix.integration.test.ts +0 -102
- package/test/vitest/integration/cache-components/cache-components.integration.test.ts +0 -389
- package/test/vitest/integration/cache-components/redis-kill-reconnect.test.ts +0 -65
- package/test/vitest/integration/cache-components/redis-quit-vs-disconnect.test.ts +0 -59
- package/test/vitest/integration/cache-components/redis-subscriber-outage.test.ts +0 -100
- package/test/vitest/integration/cache-components/scripts/redis-kill-reconnect.ts +0 -243
- package/test/vitest/integration/cache-components/scripts/redis-quit-vs-disconnect.ts +0 -113
- package/test/vitest/integration/cache-components/scripts/redis-subscriber-outage.ts +0 -379
- package/test/vitest/integration/cache-components/scripts/redis-test-helpers.ts +0 -155
- package/test/vitest/integration/nextjs-cache-handler.integration.test.ts +0 -959
- package/test/vitest/integration/pages-router.integration.test.ts +0 -430
- package/test/vitest/unit/SyncedMap-orphan-cleanup.test.ts +0 -111
- package/test/vitest/unit/SyncedMap-reconnect-repro.test.ts +0 -154
- package/test/vitest/unit/cache-components-update-tags.test.ts +0 -350
- package/test/vitest/unit/cache-ttl.test.ts +0 -67
- package/test/vitest/unit/compare-and-unlink.test.ts +0 -22
- package/test/vitest/unit/index.test.ts +0 -190
- package/test/vitest/unit/pages-router-kinds.test.ts +0 -303
- package/test/vitest/unit/reconnect-socket-already-opened.test.ts +0 -117
- package/test/vitest/unit/redis-connection.test.ts +0 -39
- package/test/vitest/unit/serializer.test.ts +0 -182
- package/test/vitest/unit/tag-revalidation.test.ts +0 -178
- package/test/vitest/unit/utils/prefix.test.ts +0 -115
- package/tsconfig.json +0 -18
- package/tsup.config.ts +0 -14
- package/vite.config.ts +0 -34
- package/vitest.cache-components.config.ts +0 -16
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
let counter = 0;
|
|
4
|
-
|
|
5
|
-
export async function GET() {
|
|
6
|
-
const data = await getSimpleCachedData();
|
|
7
|
-
return NextResponse.json(data);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async function getSimpleCachedData() {
|
|
11
|
-
'use cache';
|
|
12
|
-
|
|
13
|
-
counter++;
|
|
14
|
-
return {
|
|
15
|
-
counter,
|
|
16
|
-
timestamp: Date.now(),
|
|
17
|
-
message: 'Simple cached data without tags',
|
|
18
|
-
};
|
|
19
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { cacheLife, cacheTag } from 'next/cache';
|
|
3
|
-
|
|
4
|
-
let counter = 0;
|
|
5
|
-
|
|
6
|
-
export async function GET() {
|
|
7
|
-
const data = await getCachedDataWithLife();
|
|
8
|
-
return NextResponse.json(data);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async function getCachedDataWithLife() {
|
|
12
|
-
'use cache';
|
|
13
|
-
|
|
14
|
-
cacheLife({ stale: 1, revalidate: 2, expire: 5 });
|
|
15
|
-
cacheTag('cache-life-test');
|
|
16
|
-
|
|
17
|
-
counter++;
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
counter,
|
|
21
|
-
timestamp: Date.now(),
|
|
22
|
-
profile: { stale: 1, revalidate: 2, expire: 5 },
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { cacheTag } from 'next/cache';
|
|
3
|
-
|
|
4
|
-
let counter = 0;
|
|
5
|
-
|
|
6
|
-
export async function GET() {
|
|
7
|
-
const data = await getCachedData();
|
|
8
|
-
return NextResponse.json(data);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async function getCachedData() {
|
|
12
|
-
'use cache';
|
|
13
|
-
cacheTag('test-tag');
|
|
14
|
-
|
|
15
|
-
counter++;
|
|
16
|
-
return {
|
|
17
|
-
counter,
|
|
18
|
-
timestamp: Date.now(),
|
|
19
|
-
message: 'This data should be cached',
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { revalidateTag } from 'next/cache';
|
|
3
|
-
|
|
4
|
-
type Profile =
|
|
5
|
-
| 'max'
|
|
6
|
-
| 'default'
|
|
7
|
-
| 'seconds'
|
|
8
|
-
| 'minutes'
|
|
9
|
-
| 'hours'
|
|
10
|
-
| 'days'
|
|
11
|
-
| 'weeks'
|
|
12
|
-
| { expire: number };
|
|
13
|
-
|
|
14
|
-
export async function POST(request: Request) {
|
|
15
|
-
const body = (await request.json()) as {
|
|
16
|
-
tag?: string;
|
|
17
|
-
profile?: Profile | null;
|
|
18
|
-
};
|
|
19
|
-
const tag = body.tag || 'expire-matrix-default';
|
|
20
|
-
|
|
21
|
-
if (body.profile === undefined || body.profile === null) {
|
|
22
|
-
// Deprecated single-arg form: Next.js calls updateTags(tags) with no durations.
|
|
23
|
-
(revalidateTag as (tag: string) => void)(tag);
|
|
24
|
-
} else {
|
|
25
|
-
revalidateTag(tag, body.profile);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return NextResponse.json({
|
|
29
|
-
revalidated: true,
|
|
30
|
-
tag,
|
|
31
|
-
profile: body.profile ?? null,
|
|
32
|
-
timestamp: Date.now(),
|
|
33
|
-
});
|
|
34
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { cacheLife, cacheTag } from 'next/cache';
|
|
3
|
-
|
|
4
|
-
let counter = 0;
|
|
5
|
-
|
|
6
|
-
export async function GET(request: Request) {
|
|
7
|
-
const id = new URL(request.url).searchParams.get('id') || 'default';
|
|
8
|
-
const data = await getExpireMatrixData(id);
|
|
9
|
-
return NextResponse.json({ ...data, id });
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async function getExpireMatrixData(id: string) {
|
|
13
|
-
'use cache';
|
|
14
|
-
// Long time-based lifetime so only tag invalidation can change the value.
|
|
15
|
-
cacheLife({ stale: 300, revalidate: 3600, expire: 86_400 });
|
|
16
|
-
cacheTag(`expire-matrix-${id}`);
|
|
17
|
-
|
|
18
|
-
counter += 1;
|
|
19
|
-
return {
|
|
20
|
-
counter,
|
|
21
|
-
timestamp: Date.now(),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { revalidateTag } from 'next/cache';
|
|
3
|
-
|
|
4
|
-
export async function POST(request: Request) {
|
|
5
|
-
const body = await request.json();
|
|
6
|
-
const { tag } = body;
|
|
7
|
-
|
|
8
|
-
if (!tag) {
|
|
9
|
-
return NextResponse.json({ error: 'Tag is required' }, { status: 400 });
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
revalidateTag(tag, { expire: 1 });
|
|
13
|
-
|
|
14
|
-
return NextResponse.json({
|
|
15
|
-
revalidated: true,
|
|
16
|
-
tag,
|
|
17
|
-
timestamp: Date.now(),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
|
|
3
|
-
let counter = 0;
|
|
4
|
-
|
|
5
|
-
export async function GET() {
|
|
6
|
-
const data = await getCachedData();
|
|
7
|
-
return NextResponse.json(data);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async function getCachedData() {
|
|
11
|
-
'use cache';
|
|
12
|
-
|
|
13
|
-
counter++;
|
|
14
|
-
return {
|
|
15
|
-
counter,
|
|
16
|
-
timestamp: Date.now(),
|
|
17
|
-
message: 'Revalidated cached data',
|
|
18
|
-
};
|
|
19
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import Link from 'next/link';
|
|
2
|
-
import { cacheLife, cacheTag, revalidateTag } from 'next/cache';
|
|
3
|
-
import { Suspense } from 'react';
|
|
4
|
-
|
|
5
|
-
async function getCacheLifeSample() {
|
|
6
|
-
'use cache';
|
|
7
|
-
|
|
8
|
-
// Very short timings for manual testing.
|
|
9
|
-
cacheLife({
|
|
10
|
-
stale: 2,
|
|
11
|
-
revalidate: 4,
|
|
12
|
-
expire: 10,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
cacheTag('cache-lab:cachelife-short');
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
createdAt: Date.now(),
|
|
19
|
-
random: Math.random(),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function triggerRevalidateTag() {
|
|
24
|
-
'use server';
|
|
25
|
-
revalidateTag('cache-lab:cachelife-short', { expire: 1 });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async function CachedDataPanel() {
|
|
29
|
-
const data = await getCacheLifeSample();
|
|
30
|
-
return (
|
|
31
|
-
<div className="rounded-lg border p-5">
|
|
32
|
-
<dl className="grid grid-cols-1 gap-3 text-sm">
|
|
33
|
-
<div>
|
|
34
|
-
<dt className="font-medium">createdAt</dt>
|
|
35
|
-
<dd data-testid="createdAt" className="font-mono text-slate-700">
|
|
36
|
-
{data.createdAt}
|
|
37
|
-
</dd>
|
|
38
|
-
</div>
|
|
39
|
-
<div>
|
|
40
|
-
<dt className="font-medium">random</dt>
|
|
41
|
-
<dd data-testid="random" className="font-mono text-slate-700">
|
|
42
|
-
{data.random}
|
|
43
|
-
</dd>
|
|
44
|
-
</div>
|
|
45
|
-
<div>
|
|
46
|
-
<dt className="font-medium">cacheLife config</dt>
|
|
47
|
-
<dd className="font-mono text-slate-700">
|
|
48
|
-
{'{ stale: 2, revalidate: 4, expire: 10 }'}
|
|
49
|
-
</dd>
|
|
50
|
-
</div>
|
|
51
|
-
</dl>
|
|
52
|
-
</div>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default function CacheLifeShortPage() {
|
|
57
|
-
return (
|
|
58
|
-
<main className="mx-auto max-w-3xl p-10">
|
|
59
|
-
<div className="mb-6">
|
|
60
|
-
<Link
|
|
61
|
-
className="text-sm text-blue-600 hover:underline"
|
|
62
|
-
href="/cache-lab"
|
|
63
|
-
>
|
|
64
|
-
← Back to Cache Lab
|
|
65
|
-
</Link>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<header className="mb-6">
|
|
69
|
-
<h1 className="text-2xl font-semibold">cacheLife: short timings</h1>
|
|
70
|
-
<p className="mt-2 text-sm text-slate-600">
|
|
71
|
-
This uses <code>cacheLife</code> with short durations so you can
|
|
72
|
-
observe stale / revalidate / expire behavior quickly.
|
|
73
|
-
</p>
|
|
74
|
-
</header>
|
|
75
|
-
|
|
76
|
-
<Suspense
|
|
77
|
-
fallback={
|
|
78
|
-
<div className="rounded-lg border bg-slate-50 p-5 text-sm text-slate-700">
|
|
79
|
-
Loading cached content…
|
|
80
|
-
</div>
|
|
81
|
-
}
|
|
82
|
-
>
|
|
83
|
-
<CachedDataPanel />
|
|
84
|
-
</Suspense>
|
|
85
|
-
|
|
86
|
-
<form action={triggerRevalidateTag} className="mt-6">
|
|
87
|
-
<button
|
|
88
|
-
className="rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700"
|
|
89
|
-
type="submit"
|
|
90
|
-
>
|
|
91
|
-
revalidateTag('cache-lab:cachelife-short')
|
|
92
|
-
</button>
|
|
93
|
-
</form>
|
|
94
|
-
|
|
95
|
-
<div className="mt-6 rounded-lg border bg-slate-50 p-5 text-sm text-slate-700">
|
|
96
|
-
<div className="space-y-2">
|
|
97
|
-
<p>
|
|
98
|
-
Expected: reload a few times. Within a couple seconds, the cached
|
|
99
|
-
value may become stale; after revalidate, a fresh value should
|
|
100
|
-
appear.
|
|
101
|
-
</p>
|
|
102
|
-
<p>
|
|
103
|
-
This page deliberately puts the async work behind{' '}
|
|
104
|
-
<code>{'<Suspense>'}</code> to avoid the "Blocking Route" warning.
|
|
105
|
-
</p>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
</main>
|
|
109
|
-
);
|
|
110
|
-
}
|
package/test/nextjs-test-projects/next-app-16-0-11-cache-components/src/app/cache-lab/page.tsx
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import Link from 'next/link';
|
|
2
|
-
|
|
3
|
-
export default function CacheLabIndexPage() {
|
|
4
|
-
return (
|
|
5
|
-
<main className="mx-auto max-w-5xl p-10">
|
|
6
|
-
<header className="mb-10">
|
|
7
|
-
<h1 className="text-3xl font-semibold">Cache Lab</h1>
|
|
8
|
-
<p className="mt-2 text-slate-600">
|
|
9
|
-
Manual test pages for Next.js Cache Components (use cache, cacheLife,
|
|
10
|
-
tags, updateTag/revalidateTag, and Suspense boundaries).
|
|
11
|
-
</p>
|
|
12
|
-
</header>
|
|
13
|
-
|
|
14
|
-
<section className="grid grid-cols-1 gap-4 md:grid-cols-2">
|
|
15
|
-
<Link
|
|
16
|
-
className="rounded-lg border p-5 hover:bg-slate-50"
|
|
17
|
-
href="/cache-lab/use-cache-nondeterministic"
|
|
18
|
-
>
|
|
19
|
-
<h2 className="text-lg font-medium">use cache: non-deterministic</h2>
|
|
20
|
-
<p className="mt-1 text-sm text-slate-600">
|
|
21
|
-
Random/Date/UUID should stay identical across reloads until you
|
|
22
|
-
invalidate.
|
|
23
|
-
</p>
|
|
24
|
-
</Link>
|
|
25
|
-
|
|
26
|
-
<Link
|
|
27
|
-
className="rounded-lg border p-5 hover:bg-slate-50"
|
|
28
|
-
href="/cache-lab/cachelife-short"
|
|
29
|
-
>
|
|
30
|
-
<h2 className="text-lg font-medium">cacheLife: short timings</h2>
|
|
31
|
-
<p className="mt-1 text-sm text-slate-600">
|
|
32
|
-
Uses very small stale/revalidate/expire values so you can observe
|
|
33
|
-
SWR + expiry quickly.
|
|
34
|
-
</p>
|
|
35
|
-
</Link>
|
|
36
|
-
|
|
37
|
-
<Link
|
|
38
|
-
className="rounded-lg border p-5 hover:bg-slate-50"
|
|
39
|
-
href="/cache-lab/tag-invalidation"
|
|
40
|
-
>
|
|
41
|
-
<h2 className="text-lg font-medium">
|
|
42
|
-
Tags: updateTag vs revalidateTag
|
|
43
|
-
</h2>
|
|
44
|
-
<p className="mt-1 text-sm text-slate-600">
|
|
45
|
-
Cached component tagged via cacheTag. Trigger updateTag (immediate)
|
|
46
|
-
or revalidateTag (SWR).
|
|
47
|
-
</p>
|
|
48
|
-
</Link>
|
|
49
|
-
|
|
50
|
-
<Link
|
|
51
|
-
className="rounded-lg border p-5 hover:bg-slate-50"
|
|
52
|
-
href="/cache-lab/stale-while-revalidate"
|
|
53
|
-
>
|
|
54
|
-
<h2 className="text-lg font-medium">
|
|
55
|
-
SWR: stale-while-revalidate (slow)
|
|
56
|
-
</h2>
|
|
57
|
-
<p className="mt-1 text-sm text-slate-600">
|
|
58
|
-
Forces slow recomputation so you can see whether stale is served
|
|
59
|
-
immediately while refresh happens in the background.
|
|
60
|
-
</p>
|
|
61
|
-
</Link>
|
|
62
|
-
|
|
63
|
-
<Link
|
|
64
|
-
className="rounded-lg border p-5 hover:bg-slate-50"
|
|
65
|
-
href="/cache-lab/runtime-data-suspense"
|
|
66
|
-
>
|
|
67
|
-
<h2 className="text-lg font-medium">Runtime data + Suspense</h2>
|
|
68
|
-
<p className="mt-1 text-sm text-slate-600">
|
|
69
|
-
Reads cookies() at request time in a non-cached component and passes
|
|
70
|
-
it into a cached component to show correct boundaries.
|
|
71
|
-
</p>
|
|
72
|
-
</Link>
|
|
73
|
-
|
|
74
|
-
<Link
|
|
75
|
-
className="rounded-lg border p-5 hover:bg-slate-50"
|
|
76
|
-
href="/cache-lab/use-cache-remote"
|
|
77
|
-
>
|
|
78
|
-
<h2 className="text-lg font-medium">use cache: remote</h2>
|
|
79
|
-
<p className="mt-1 text-sm text-slate-600">
|
|
80
|
-
Exercises <code>cacheHandlers.remote</code> with Redis-backed
|
|
81
|
-
streams and <code>updateTag</code>.
|
|
82
|
-
</p>
|
|
83
|
-
</Link>
|
|
84
|
-
|
|
85
|
-
<Link
|
|
86
|
-
className="rounded-lg border p-5 hover:bg-slate-50"
|
|
87
|
-
href="/cache-lab/revalidate-durations"
|
|
88
|
-
>
|
|
89
|
-
<h2 className="text-lg font-medium">revalidateTag durations</h2>
|
|
90
|
-
<p className="mt-1 text-sm text-slate-600">
|
|
91
|
-
Deferred tag invalidation via{' '}
|
|
92
|
-
<code>revalidateTag(tag, {'{ expire }'})</code> and SWR behavior.
|
|
93
|
-
</p>
|
|
94
|
-
</Link>
|
|
95
|
-
</section>
|
|
96
|
-
|
|
97
|
-
<section className="mt-12 rounded-lg border bg-slate-50 p-5">
|
|
98
|
-
<h3 className="font-medium">How to use</h3>
|
|
99
|
-
<div className="mt-2 space-y-2 text-sm text-slate-700">
|
|
100
|
-
<p>
|
|
101
|
-
Open each page in 2 tabs and compare behavior while reloading.
|
|
102
|
-
Observe which values stay stable, and which update.
|
|
103
|
-
</p>
|
|
104
|
-
<p>
|
|
105
|
-
Use the buttons on each page to trigger tag invalidation and observe
|
|
106
|
-
how quickly new content becomes visible.
|
|
107
|
-
</p>
|
|
108
|
-
</div>
|
|
109
|
-
</section>
|
|
110
|
-
</main>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import Link from 'next/link';
|
|
2
|
-
import { Suspense } from 'react';
|
|
3
|
-
import { cacheLife, cacheTag, revalidateTag } from 'next/cache';
|
|
4
|
-
|
|
5
|
-
function sleep(ms: number): Promise<void> {
|
|
6
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
async function getSlowTaggedValue() {
|
|
10
|
-
'use cache';
|
|
11
|
-
|
|
12
|
-
cacheLife({ stale: 60, revalidate: 120, expire: 300 });
|
|
13
|
-
cacheTag('cache-lab:durations');
|
|
14
|
-
|
|
15
|
-
await sleep(2500);
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
computedAt: Date.now(),
|
|
19
|
-
value: Math.random(),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function triggerDeferredRevalidateTag() {
|
|
24
|
-
'use server';
|
|
25
|
-
revalidateTag('cache-lab:durations', { expire: 2 });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async function CachedPanel() {
|
|
29
|
-
const data = await getSlowTaggedValue();
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div className="rounded-lg border p-5">
|
|
33
|
-
<div className="text-sm text-slate-700">
|
|
34
|
-
<div>
|
|
35
|
-
<span className="font-medium">computedAt:</span>{' '}
|
|
36
|
-
<span data-testid="computedAt" className="font-mono">
|
|
37
|
-
{data.computedAt}
|
|
38
|
-
</span>
|
|
39
|
-
</div>
|
|
40
|
-
<div className="mt-1">
|
|
41
|
-
<span className="font-medium">value:</span>{' '}
|
|
42
|
-
<span data-testid="value" className="font-mono">
|
|
43
|
-
{data.value}
|
|
44
|
-
</span>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default function RevalidateDurationsPage() {
|
|
52
|
-
return (
|
|
53
|
-
<main className="mx-auto max-w-3xl p-10">
|
|
54
|
-
<div className="mb-6">
|
|
55
|
-
<Link
|
|
56
|
-
className="text-sm text-blue-600 hover:underline"
|
|
57
|
-
href="/cache-lab"
|
|
58
|
-
>
|
|
59
|
-
← Back to Cache Lab
|
|
60
|
-
</Link>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<header className="mb-6">
|
|
64
|
-
<h1 className="text-2xl font-semibold">
|
|
65
|
-
revalidateTag durations (SWR stale window)
|
|
66
|
-
</h1>
|
|
67
|
-
<p className="mt-2 text-sm text-slate-600">
|
|
68
|
-
Calls <code>revalidateTag(tag, {'{ expire: 2 }'})</code>. The handler
|
|
69
|
-
should mark the tag stale immediately while keeping the Redis entry so
|
|
70
|
-
the next request can serve stale content (SWR) during refresh.
|
|
71
|
-
</p>
|
|
72
|
-
</header>
|
|
73
|
-
|
|
74
|
-
<Suspense
|
|
75
|
-
fallback={
|
|
76
|
-
<div className="rounded-lg border bg-slate-50 p-5 text-sm text-slate-700">
|
|
77
|
-
Loading cached content… (first load can take ~2.5s)
|
|
78
|
-
</div>
|
|
79
|
-
}
|
|
80
|
-
>
|
|
81
|
-
<CachedPanel />
|
|
82
|
-
</Suspense>
|
|
83
|
-
|
|
84
|
-
<form action={triggerDeferredRevalidateTag} className="mt-6">
|
|
85
|
-
<button
|
|
86
|
-
className="rounded-md border border-blue-600 bg-white px-4 py-2 text-sm font-medium text-blue-700 hover:bg-blue-50"
|
|
87
|
-
type="submit"
|
|
88
|
-
>
|
|
89
|
-
revalidateTag('cache-lab:durations', {'{ expire: 2 }'})
|
|
90
|
-
</button>
|
|
91
|
-
</form>
|
|
92
|
-
|
|
93
|
-
<div className="mt-6 rounded-lg border bg-slate-50 p-5 text-sm text-slate-700">
|
|
94
|
-
<p className="font-medium">How to observe SWR invalidation</p>
|
|
95
|
-
<ol className="mt-2 list-decimal space-y-1 pl-5">
|
|
96
|
-
<li>Load once (expect ~2.5s).</li>
|
|
97
|
-
<li>Click the button, then reload immediately.</li>
|
|
98
|
-
<li>
|
|
99
|
-
The reload should still show the old values (fast SWR). After
|
|
100
|
-
background refresh (~2.5s), values should change.
|
|
101
|
-
</li>
|
|
102
|
-
</ol>
|
|
103
|
-
</div>
|
|
104
|
-
</main>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import Link from 'next/link';
|
|
2
|
-
import { Suspense } from 'react';
|
|
3
|
-
import { cookies } from 'next/headers';
|
|
4
|
-
|
|
5
|
-
export default function RuntimeDataSuspensePage() {
|
|
6
|
-
return (
|
|
7
|
-
<main className="mx-auto max-w-3xl p-10">
|
|
8
|
-
<div className="mb-6">
|
|
9
|
-
<Link
|
|
10
|
-
className="text-sm text-blue-600 hover:underline"
|
|
11
|
-
href="/cache-lab"
|
|
12
|
-
>
|
|
13
|
-
← Back to Cache Lab
|
|
14
|
-
</Link>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<header className="mb-6">
|
|
18
|
-
<h1 className="text-2xl font-semibold">Runtime data + Suspense</h1>
|
|
19
|
-
<p className="mt-2 text-sm text-slate-600">
|
|
20
|
-
This page reads <code>cookies()</code> at request time (runtime data),
|
|
21
|
-
then passes a value into a cached function. The runtime read is
|
|
22
|
-
wrapped in <code>{'<Suspense>'}</code> so it is an explicit dynamic
|
|
23
|
-
boundary.
|
|
24
|
-
</p>
|
|
25
|
-
</header>
|
|
26
|
-
|
|
27
|
-
<Suspense
|
|
28
|
-
fallback={
|
|
29
|
-
<div className="rounded-lg border bg-slate-50 p-5 text-sm text-slate-700">
|
|
30
|
-
Loading runtime cookie…
|
|
31
|
-
</div>
|
|
32
|
-
}
|
|
33
|
-
>
|
|
34
|
-
<RuntimeCookieBlock />
|
|
35
|
-
</Suspense>
|
|
36
|
-
|
|
37
|
-
<div className="mt-6 rounded-lg border bg-slate-50 p-5 text-sm text-slate-700">
|
|
38
|
-
<div className="space-y-2">
|
|
39
|
-
<p>
|
|
40
|
-
Expected: changing the cookie changes the <em>input</em> to the
|
|
41
|
-
cached function, producing a different cache entry.
|
|
42
|
-
</p>
|
|
43
|
-
<p>
|
|
44
|
-
The cached function itself uses <code>use cache</code>, so for the
|
|
45
|
-
same cookie value, it should return a stable payload across reloads.
|
|
46
|
-
</p>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</main>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async function setCookie(value: string) {
|
|
54
|
-
'use server';
|
|
55
|
-
const store = await cookies();
|
|
56
|
-
store.set('cache_lab_session', value, { path: '/' });
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function setCookieUserA() {
|
|
60
|
-
'use server';
|
|
61
|
-
await setCookie('user-a');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async function setCookieUserB() {
|
|
65
|
-
'use server';
|
|
66
|
-
await setCookie('user-b');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async function RuntimeCookieBlock() {
|
|
70
|
-
const store = await cookies();
|
|
71
|
-
const sessionId = store.get('cache_lab_session')?.value || 'anonymous';
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<div className="rounded-lg border p-5">
|
|
75
|
-
<div className="mb-4 text-sm">
|
|
76
|
-
<div>
|
|
77
|
-
<span className="font-medium">cookie cache_lab_session:</span>{' '}
|
|
78
|
-
<span data-testid="cookie" className="font-mono text-slate-700">
|
|
79
|
-
{sessionId}
|
|
80
|
-
</span>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<div className="flex flex-col gap-3 sm:flex-row">
|
|
85
|
-
<form action={setCookieUserA}>
|
|
86
|
-
<button
|
|
87
|
-
className="w-full rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700"
|
|
88
|
-
type="submit"
|
|
89
|
-
>
|
|
90
|
-
Set cookie: user-a
|
|
91
|
-
</button>
|
|
92
|
-
</form>
|
|
93
|
-
<form action={setCookieUserB}>
|
|
94
|
-
<button
|
|
95
|
-
className="w-full rounded-md border border-blue-600 bg-white px-4 py-2 text-sm font-medium text-blue-700 hover:bg-blue-50"
|
|
96
|
-
type="submit"
|
|
97
|
-
>
|
|
98
|
-
Set cookie: user-b
|
|
99
|
-
</button>
|
|
100
|
-
</form>
|
|
101
|
-
</div>
|
|
102
|
-
|
|
103
|
-
<div className="mt-5">
|
|
104
|
-
<CachedPerSession sessionId={sessionId} />
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async function CachedPerSession({ sessionId }: { sessionId: string }) {
|
|
111
|
-
'use cache';
|
|
112
|
-
|
|
113
|
-
const payload = {
|
|
114
|
-
sessionId,
|
|
115
|
-
createdAt: Date.now(),
|
|
116
|
-
random: Math.random(),
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
return (
|
|
120
|
-
<div className="rounded-md bg-slate-50 p-4 text-sm">
|
|
121
|
-
<div className="font-medium">Cached payload (keyed by sessionId)</div>
|
|
122
|
-
<pre data-testid="payload" className="mt-2 overflow-x-auto text-xs">
|
|
123
|
-
{JSON.stringify(payload, null, 2)}
|
|
124
|
-
</pre>
|
|
125
|
-
</div>
|
|
126
|
-
);
|
|
127
|
-
}
|