Drivers
Vercel KV
Store data in a Vercel KV Store.
Please check Vercel KV Limits.
import { createStorage } from "unstorage";
import vercelKVDriver from "unstorage/drivers/vercel-kv";
const storage = createStorage({
driver: vercelKVDriver({
// url: "https://<your-project-slug>.kv.vercel-storage.com", // KV_REST_API_URL
// token: "<your secret token>", // KV_REST_API_TOKEN
// base: "test",
// env: "KV",
// ttl: 60, // in seconds
}),
});
To use, you will need to install @vercel/kv
dependency in your project:
{
"dependencies": {
"@vercel/kv": "latest"
}
}
Note: For driver options type support, you might need to install @upstash/redis
dev dependency as well.
Options:
url
: Rest API URL to use for connecting to your Vercel KV store. Default isKV_REST_API_URL
.token
: Rest API Token to use for connecting to your Vercel KV store. Default isKV_REST_API_TOKEN
.base
: optional Prefix to use for all keys. Can be used for namespacing.env
: optional Flag to customize environment variable prefix (Default isKV
). Set tofalse
to disable env inference forurl
andtoken
options.
See @upstash/redis for all available options.