Data cache

fetch 함수의 결과값을 캐싱하는 것

Full route cache

static routes의 결과를 캐싱하는 것 (페이지를 캐싱하는 느낌)

Router cache (client-side cache)

To store payloads of pages in browser

Lasts for a session

Gets refreshed when we reload

issues/new 에서 새로운 이슈를 등록하고, router.push(’/issues’) 로 돌아왔을 때 full route cache와 router cache 때문에 새로 생긴 목록이 바로 보이지 않는다. 이때 사용할 수 있는 게 dynamic, revalidate 옵션.

static하게 빌드되던 페이지를 dynamic 페이지로 바꿀 수 있다.

// export default 바로 전 라인에 써주면 된다.
export const dynamic = 'force-dynamic';

dynamic 페이지로 바꿔도 router cache 때문에 새로운 목록이 바로 보이지는 않는다. 그렇기 때문에 새로고침을 강제로 시켜준다.

const router = useRouter();

// 특정 작업 성공 시
router.refresh();