feat : 6 astra improve it
This commit is contained in:
Vendored
+13
-3
@@ -2,7 +2,7 @@ import "server-only";
|
||||
|
||||
import { cacheLife, cacheTag } from "next/cache";
|
||||
|
||||
import { getPublicGuide, listPublicGuideCards } from "@/lib/guides/queries";
|
||||
import { getPublicGuide, getPublicGuideSummary, listPublicGuideCards } from "@/lib/guides/queries";
|
||||
import {
|
||||
DIRECTORY_CACHE_TAG,
|
||||
GLOSSARY_CACHE_TAG,
|
||||
@@ -17,11 +17,21 @@ export async function getCachedPublicGuideCards() {
|
||||
return listPublicGuideCards();
|
||||
}
|
||||
|
||||
export async function getCachedPublicGuide(slug: string) {
|
||||
export async function getCachedPublicGuide(slug: string, section = "overview") {
|
||||
"use cache: remote";
|
||||
cacheLife({ stale: 15, revalidate: 60, expire: 60 * 60 });
|
||||
const result = await getPublicGuide(slug);
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user