本页还没有译文
本页 15 段还没译成日本語,下面显示的是英文原文。KV namespaces
还没翻译译自英文(developers.cloudflare.com)本页 15 段都还没译
A KV namespace is a key-value database replicated to Cloudflare’s global network.
Bind your KV namespaces through Wrangler or via the Cloudflare dashboard.
Note
KV namespace IDs are public and bound to your account.
Jurisdictions
Namespaces can optionally be restricted to a jurisdiction to durably store data only within a specific region. Refer to Data location for more information.
Bind your KV namespace through Wrangler
To bind KV namespaces to your Worker, assign an array of the below object to the kv_namespaces key.
-
bindingstring required- The binding name used to refer to the KV namespace.
-
idstring required- The ID of the KV namespace.
-
preview_idstring optional- The ID of the KV namespace used during
wrangler dev.
- The ID of the KV namespace used during
Example:
{
"kv_namespaces": [
{
"binding": "<TEST_NAMESPACE>",
"id": "<TEST_ID>"
}
]
}[[kv_namespaces]]
binding = "<TEST_NAMESPACE>"
id = "<TEST_ID>"
Bind your KV namespace via the dashboard
To bind the namespace to your Worker in the Cloudflare dashboard:
-
In the Cloudflare dashboard, go to the Workers & Pages page.
-
Select your Worker.
-
Select Settings > Bindings.
-
Select Add.
-
Select KV Namespace.
-
Enter your desired variable name (the name of the binding).
-
Select the KV namespace you wish to bind the Worker to.
-
Select Deploy.