Skip to content

Commit 8011880

Browse files
authored
Add overloaded methods signatures
1 parent 231525b commit 8011880

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/content/docs/kv/api/read-key-value-pairs.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ The following methods are provided to read from KV:
4646
To get the value for a given key, call the `get()` method on any KV namespace you have bound to your Worker code:
4747

4848
```js
49-
env.NAMESPACE.get(key, type?, options?);
49+
env.NAMESPACE.get(key, type?);
50+
//OR
51+
env.NAMESPACE.get(key, options?);
5052
```
5153
5254
The `get()` method returns a promise you can `await` on to get the value. If the key is not found, the promise will resolve with the literal value `null`.
@@ -61,7 +63,7 @@ The `get()` method returns a promise you can `await` on to get the value. If the
6163
cacheTtl?: number,
6264
type?: "text" | "json" | "arrayBuffer" | "stream"
6365
}`
64-
- Optional. Object containing the `cacheTtl` and `type` properties. The optional `cacheTtl` property defines the length of time in seconds that a KV result is cached in the global network location it is accessed from (minimum: 60). The `type` property defines the type of the value to be returned.
66+
- Optional. Object containing the optional `cacheTtl` and `type` properties. The `cacheTtl` property defines the length of time in seconds that a KV result is cached in the global network location it is accessed from (minimum: 60). The `type` property defines the type of the value to be returned.
6567
6668
#### Response
6769
@@ -79,7 +81,9 @@ The `get()` method may return stale values. If a given key has recently been rea
7981
To get the value for a given key along with its metadata, call the `getWithMetadata()` method on any KV namespace you have bound to your Worker code:
8082
8183
```js
82-
env.NAMESPACE.getWithMetadata(key, type?, options?);
84+
env.NAMESPACE.getWithMetadata(key, type?);
85+
//OR
86+
env.NAMESPACE.getWithMetadata(key, options?);
8387
```
8488
8589
Metadata is a serializable value you append to each KV entry.
@@ -94,7 +98,7 @@ Metadata is a serializable value you append to each KV entry.
9498
cacheTtl?: number,
9599
type?: "text" | "json" | "arrayBuffer" | "stream"
96100
}`
97-
- Optional. Object containing the `cacheTtl` and `type` properties. The optional `cacheTtl` property defines the length of time in seconds that a KV result is cached in the global network location it is accessed from (minimum: 60). The `type` property defines the type of the value to be returned.
101+
- Optional. Object containing the optional `cacheTtl` and `type` properties. The `cacheTtl` property defines the length of time in seconds that a KV result is cached in the global network location it is accessed from (minimum: 60). The `type` property defines the type of the value to be returned.
98102
99103
#### Response
100104

0 commit comments

Comments
 (0)