-
Notifications
You must be signed in to change notification settings - Fork 10k
KV: add bulk gets documentation #21392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
d5a732c
25cfc00
9b31c27
2448cd3
4ea50e7
20a5d74
69b5d20
eff5523
a70d1d7
72f0b94
baff3c0
af2c1c9
21e858c
dbcca5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| title: Read multiple keys from Workers KV with bulk reads | ||
| description: You can now retrieve up to 100 keys in a single bulk read request to Workers KV. | ||
| products: | ||
| - kv | ||
| date: 2025-04-17T14:00:00Z | ||
| --- | ||
|
|
||
| You can now retrieve up to 100 keys in a single bulk read request made to Workers KV. | ||
|
||
|
|
||
| This makes it easier to request multiple KV pairs within a single Worker invocation. Retrieving many key-value pairs using the bulk read operation is more performant than making individual requests since bulk read operations are not affected by [Workers simultaneous connection limits](/workers/platform/limits/#simultaneous-open-connections). | ||
| ```js | ||
| // Read single key | ||
| const key = "key-a"; | ||
| const value = await env.NAMESPACE.get(keys); | ||
|
|
||
| // Read multiple keys | ||
| const keys = ["key-a", "key-b", "key-c", ...] // up to 100 keys | ||
| const values : Map<string, string?> = await env.NAMESPACE.get(keys); | ||
thomasgauvin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Print the value of "key-a" to the console. | ||
| console.log(`The first key is ${values.get("key-a")}.`) | ||
| ``` | ||
|
|
||
| Consult the [Workers KV Read key-value pairs API](/kv/api/read-key-value-pairs/) for full details on Workers KV's new bulk reads support. | ||
Uh oh!
There was an error while loading. Please reload this page.