Files
buzz-sheet/lib/cache/public.ts
T
gunshiz 249af29e9b
CI / Verify (push) Successful in 1m21s
CI / Build immutable images and deploy (push) Successful in 4m32s
feat : remove legacy feature
2026-09-10 19:45:06 +07:00

28 lines
774 B
TypeScript

import "server-only";
import { cacheLife, cacheTag } from "next/cache";
import { getPublicGuide, listPublicGuideCards } from "@/lib/guides/queries";
import {
DIRECTORY_CACHE_TAG,
GLOSSARY_CACHE_TAG,
pageCacheTag,
} from "@/lib/cache/tags";
export async function getCachedPublicGuideCards() {
"use cache: remote";
cacheLife({ stale: 30, revalidate: 60, expire: 60 * 60 });
cacheTag(DIRECTORY_CACHE_TAG);
cacheTag(GLOSSARY_CACHE_TAG);
return listPublicGuideCards();
}
export async function getCachedPublicGuide(slug: string) {
"use cache: remote";
cacheLife({ stale: 15, revalidate: 60, expire: 60 * 60 });
const result = await getPublicGuide(slug);
cacheTag(GLOSSARY_CACHE_TAG);
if (result) cacheTag(pageCacheTag(result.id));
return result;
}