Skip to content

Commit d1ba6cd

Browse files
Oxyjunvy-ton
andauthored
[DO] Cross referencing limits for key and values to the limits page (cloudflare#23014)
* Cross referencing limits for key and values to the limits page. * Update src/content/docs/durable-objects/api/storage-api.mdx Co-authored-by: Vy Ton <[email protected]> --------- Co-authored-by: Vy Ton <[email protected]>
1 parent 96ca208 commit d1ba6cd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/content/docs/durable-objects/api/storage-api.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,19 @@ ctx.storage.onNextSessionRestoreBookmark(bookmark);
227227

228228
- <code>put(key <Type text="string" />, value <Type text="any" />, options{" "}<Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise" />
229229

230-
- Stores the value and associates it with the given key. The value can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), which is true of most types. Keys are limited to a max size of 2,048 bytes and values are limited to 128 KiB (131,072 bytes).<br/><br/>
230+
- Stores the value and associates it with the given key. The value can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), which is true of most types.
231+
232+
The size of keys and values have different limits depending on the Durable Object storage backend you are using. Refer to either:
233+
- [SQLite-backed Durable Object limits](/durable-objects/platform/limits/#sqlite-backed-durable-objects-general-limits)
234+
- [KV-backed Durable Object limits](/durable-objects/platform/limits/#key-value-backed-durable-objects-general-limits).<br/><br/>
231235

232236
- <code>put(entries <Type text="Object" />, options <Type text="Object" />{" "}<MetaInfo text="optional" />)</code>: <Type text="Promise" />
233237

234238
- Takes an Object and stores each of its keys and values to storage.
235239
- Each value can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm), which is true of most types.
236-
- Supports up to 128 key-value pairs at a time. Each key is limited to a maximum size of 2,048 bytes and each value is limited to 128 KiB (131,072 bytes).
240+
- Supports up to 128 key-value pairs at a time. The size of keys and values have different limits depending on the flavor of Durable Object you are using. Refer to either:
241+
- [SQLite-backed Durable Object limits](/durable-objects/platform/limits/#sqlite-backed-durable-objects-general-limits)
242+
- [KV-backed Durable Object limits](/durable-objects/platform/limits/#key-value-backed-durable-objects-general-limits)
237243

238244
### `delete`
239245

0 commit comments

Comments
 (0)