添加服务端运行警告

This commit is contained in:
2026-04-09 15:46:54 +08:00
parent 2de3841f7d
commit cd689aba98
7 changed files with 43 additions and 24 deletions

View File

@ -0,0 +1,18 @@
import './server-only.ts'
import type { RenderableTreeNode } from '@markdoc/markdoc'
import KeyV from 'keyv'
import { createHash } from 'node:crypto'
const markdocVersion = '1'
export const markdocCache = new KeyV<RenderableTreeNode>({
namespace: `markdoc-cache-${markdocVersion}`,
ttl: 1000 * 60 * 60 * 24 * 7,
})
export const generateCacheKey = (content: string) => {
return createHash('sha256')
.update(content)
.update(markdocVersion)
.digest('hex')
}