Trung BìnhNext.js iconNext.js

fetch cache trong Next.js App Router hoạt động như thế nào?

Next.js extend native fetch với caching:

  • fetch(url) mặc định no-store từ Next.js 15+ (trước đó cache).
  • { cache: 'force-cache' } để opt-in cache.
  • { next: { revalidate: 60 } } revalidate sau 60 giây.
  • { next: { tags: ['posts'] } } tag để invalidate theo tag.

Data cache tách biệt với Full Route Cache.

Xem toàn bộ Next.js cùng filter theo level & chủ đề con.

Mở danh sách Next.js