数据获取| 获取 缓存 和重新验证

121 阅读1分钟

1.服务端使用fetch

next拓展原声fetch web api 增加缓存和重新验证 在 Next 清除数据缓存并重新获取最新数据的过程就叫做重新验证(Revalidation)。

// 基于时间的重新验证
fetch('https://...',{ next: { revalidate: 3600 } })

// 路由配置 layout.js | page.js 
export const revalidate = 3600