mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 15:13:07 +00:00
17 lines
599 B
TypeScript
17 lines
599 B
TypeScript
import 'server-only'
|
|
|
|
import type { Config } from '@/payload-types'
|
|
|
|
import { revalidateTag } from 'next/cache'
|
|
|
|
// Tag vocabulary + revalidation helper only. Imported by globals'
|
|
// afterChange hooks (aggregated by payload.config.ts), so it must NOT import
|
|
// `@payload-config` — see the cycle note in `documents.ts`. Config-dependent
|
|
// cached reads live in `globalReads.ts`.
|
|
|
|
type Global = keyof Config['globals']
|
|
|
|
export const getGlobalCacheTag = (slug: string) => `global_${slug}`
|
|
|
|
export const revalidateGlobal = <Slug extends Global>(slug: Slug) =>
|
|
revalidateTag(getGlobalCacheTag(slug))
|