Trung BìnhNext.js iconNext.js

On-demand revalidation trong Next.js là gì?

On-demand revalidation cho phép invalidate cache và regenerate pages ngay lập tức thay vì đợi timeout.

  • Pages Router: res.revalidate('/path') trong API route.
  • App Router: revalidatePath('/path') hoặc revalidateTag('posts') trong Server Action hoặc Route Handler.

Phù hợp khi CMS webhook trigger cần update content ngay.

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

Mở danh sách Next.js