From e62e5e32099daecb1c34184578cc8d07edaedd7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=84=9D=EC=A7=84?= Date: Sun, 29 Sep 2024 22:46:09 +0900 Subject: [PATCH] =?UTF-8?q?[no-issue]=20fix:=20=EC=98=88=EC=8B=9C=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../functions/unstable_cache.mdx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pages/docs/app/api-reference/functions/unstable_cache.mdx b/pages/docs/app/api-reference/functions/unstable_cache.mdx index ad0e048..d4c5f96 100644 --- a/pages/docs/app/api-reference/functions/unstable_cache.mdx +++ b/pages/docs/app/api-reference/functions/unstable_cache.mdx @@ -51,17 +51,17 @@ const data = unstable_cache(fetchData, keyParts, options)() import { unstable_cache } from 'next/cache'; export default async function Page({ params }: { params: { userID: string } }) { - const getCachedUser = unstable_cache( - async () => { - - return { id: params.userID }; + const getCachedUser = unstable_cache( + async () => { + return { id: params.userId } }, [params.userID], // 여기서 userID를 keyParts에 추가하여 Next.js가 서로 다른 userID에 대해 별도의 캐시를 만들 수 있도록 합니다. { tags: ["cached-user-tag"], revalidate: 60, } -); + ); + ... } ``` @@ -70,17 +70,17 @@ export default async function Page({ params }: { params: { userID: string } }) { import { unstable_cache } from 'next/cache'; export default async function Page({ params }) { - const getCachedUser = unstable_cache( - async () => { - - return { id: params.userID }; + const getCachedUser = unstable_cache( + async () => { + return { id: params.userId } }, [params.userID], // 여기서 userID를 keyParts에 추가하여 Next.js가 서로 다른 userID에 대해 별도의 캐시를 만들 수 있도록 합니다. { tags: ["cached-user-tag"], revalidate: 60, } -); + ); + ... } ```