Functions

Fetch cache option

Server fetch options select persistent response reuse or opt out; choose explicit policy and distinguish prerendering and HTTP caching. Source: https://nextjs.org/docs/app/api-reference/functions/fetch

Formal Syntax & Structure

nextjs syntaxnextjs
fetch(url, { cache: 'force-cache' | 'no-store' })

Working Example

Example Snippetnextjs
// Partial server helper; the local origin is provided by the V6 lab.export async function readPublicCatalog() {  const response = await fetch('http://127.0.0.1:4317/catalog', {    cache: 'force-cache', next: { tags: ['catalog'] }  });  if (!response.ok) throw new Error('Catalog unavailable');  return response.json(); // validate before rendering real external data}
Next.js Reference