Skip to main content

With non-deterministic operations 실전 서브앱

use cache 안의 비결정 연산은 재검증 전까지 고정됩니다.

request/rev를 바꿔 고정 스냅샷과 재검증 후 변경을 확인해보세요.

파일 구조

cache-components/with-non-deterministic-operations/
|- page.tsx
\- demo/
   \- page.tsx

핵심 코드

'use cache'
const random = Math.random()
const now = Date.now()

실전 점검 체크리스트

  • - 공유/개별 요구 먼저 결정
  • - 재검증 트리거 설계
  • - 필요 시 cache 경계 밖으로 이동
← 스터디로 돌아가기