Vercel KV 数据库适配器允许您在 Tina 中使用 Vercel KV 数据库。此适配器使用 Upstash Redis 客户端,因此也可以与 Upstash Redis 一起使用。
在寻找代码吗?查看 GitHub 仓库。
要开始使用,您需要设置一些环境变量。
首先从 Vercel 或 Upstash 仪表板复制您的值。
然后将以下环境变量添加到您的项目中:
KV_REST_API_URL=***KV_REST_API_TOKEN=***
//...import { RedisLevel } from 'upstash-redis-level'export default isLocal? createLocalDatabase(): createDatabase({// ...databaseAdapter: new RedisLevel({namespace: branch,redis: {url: process.env.KV_REST_API_URL || 'http://localhost:8079',token: process.env.KV_REST_API_TOKEN || 'example_token',},debug: process.env.DEBUG === 'true' || false,}),})