Functions

cacheTag

In the enabled Cache Components lane, use cacheTag inside an eligible cached scope. Documented custom tags are limited to 256 characters each and 128 entries. Use bounded public domain labels; tags do not establish authorization. Source: https://nextjs.org/docs/app/api-reference/functions/cacheTag. Documentation-reviewed illustrative draft; exact package and execution not verified.

Formal Syntax & Structure

nextjs syntaxnextjs
cacheTag(...tags)

Working Example

Example Snippetnextjs
import { cacheLife, cacheTag } from 'next/cache';export async function book(id: 'fern' | 'river') { 'use cache'; cacheLife('hours'); cacheTag('catalog', `book:${id}`); return { id, title: id === 'fern' ? 'Fern Atlas' : 'River Walk' };}
Next.js Reference