import { getCacheClient } from "@/services/dataCache" import { resolve as resolveEntry } from "@/utils/entry" import type { Lang } from "@/constants/languages" export const fetchAndCacheEntry = async (path: string, lang: Lang) => { path = path || "/" const cacheKey = `${lang}:resolveentry:${path}` const cache = await getCacheClient() return cache.cacheOrGet( cacheKey, async (overrideTTL) => { const { contentType, uid } = await resolveEntry(path, lang) if (!contentType || !uid) { overrideTTL?.("10m") } return { contentType, uid, } }, "1d" ) }