Component level 에서 caching
Next.js 16 가 'use cache' 를 component 와 function 통째 작동하는 primitive 로 introduce, fetch() 만 아님. 실험적 unstable_cache 를 더 깔끔한 directive-based API 로 대체.
3 가지 building block
| API | 용도 |
|---|---|
'use cache' | Component 또는 function 을 cacheable 로 mark |
cacheLife(profile) | Cache duration 설정 (built-in profile 또는 custom) |
cacheTag(...tags) | On-demand invalidation 위해 cached output 에 tag |
Built-in cacheLife profile
Profile name 사용하면 framework 가 합리적 default 골라: 'seconds', 'minutes', 'hours', 'days', 'weeks', 'max'. Custom profile 이 stale / revalidate / expire 독립적으로 설정 가능.
PPR 와 어떻게 compose
'use cache' 가 Partial Prerendering 와 integrate: cached component 가 build time 에 render 되고 static shell 일부 됨, 같은 route 에서 uncached 부분은 dynamic 유지.