ServergetServerFunctionMeta编辑此页面getServerFunctionMeta 返回一个特定于函数的 id 字符串,当服务器函数在多个 CPU 核心或工作进程上并行运行时,这个 id 在所有实例中保持稳定。 这个 id 属性在不同的构建之间可能会且_一定会_发生变化。 import { getServerFunctionMeta } from "@solidjs/start/server"; // 或者一些内存数据库const appCache: any = globalThis; const counter = async () => { "use server"; const { id } = getServerFunctionMeta()!; const key = `counter_${id}`; appCache[key] = appCache[key] ?? 0; appCache[key]++; return appCache[key] as number;}; 参数 getServerFunctionMeta(): { id: string }报告此页面问题上一个← GET下一个HttpHeader →