Skip to content

Commit 70c8889

Browse files
authored
update edge examples
1 parent fb41810 commit 70c8889

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ import { get } from '@upstash/redis';
7777

7878
### Edge Support
7979

80-
> Only GET requests are supported in Edge Caching. As a result, write/update commands are not supported.
80+
Once you set `edgeUrl`, all read commands are fetched using edge url. The REST URL is used for write/update commands.
8181

8282
```typescript
8383
import upstash from '@upstash/redis';
@@ -90,12 +90,15 @@ const redis = upstash({
9090

9191
(async () => {
9292
try {
93+
// the below reads using edge url
9394
const { data, error, metadata } = await redis.get('key');
9495
if (error) throw error;
9596
console.log(data);
9697
// -> null | string
9798
console.log(metadata);
9899
// -> { edge: boolean, cache: null | 'miss' | 'hit' }
100+
// the below reads using REST url (non-edge)
101+
const { data2, error2, metadata2 } = await redis.get('key', {edge: false});
99102
} catch (error) {
100103
console.error(error);
101104
}

0 commit comments

Comments
 (0)