Files
buzz-sheet/lib/cache/public.ts
T
gunshiz 87e6bcd96f
CI / Verify and audit (push) Successful in 2m33s
CI / Build, scan and deploy immutable images (push) Failing after 1m29s
feat : 6 astra improve it
2026-09-22 18:28:18 +07:00

38 lines
1.1 KiB
TypeScript

import "server-only";
import { cacheLife, cacheTag } from "next/cache";
import { getPublicGuide, getPublicGuideSummary, 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, section = "overview") {
"use cache: remote";
cacheLife({ stale: 15, revalidate: 60, expire: 60 * 60 });
const result = await getPublicGuide(slug, section);
cacheTag(GLOSSARY_CACHE_TAG);
cacheTag(DIRECTORY_CACHE_TAG);
if (result) cacheTag(pageCacheTag(result.id));
return result;
}
export async function getCachedPublicGuideSummary(slug: string) {
"use cache: remote";
cacheLife({ stale: 15, revalidate: 60, expire: 60 * 60 });
cacheTag(DIRECTORY_CACHE_TAG);
const result = await getPublicGuideSummary(slug);
if (result) cacheTag(pageCacheTag(result.id));
return result;
}