Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/upstash/upstash-redis
Browse files Browse the repository at this point in the history
  • Loading branch information
ademilter committed Nov 6, 2021
2 parents 93681ca + 8773b4a commit 5593a18
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import { get } from '@upstash/redis';

### Edge Support

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

```typescript
import upstash from '@upstash/redis';
Expand All @@ -90,12 +90,17 @@ const redis = upstash({

(async () => {
try {
// the below reads using edge url
const { data, error, metadata } = await redis.get('key');
if (error) throw error;
console.log(data);
// -> null | string
console.log(metadata);
// -> { edge: boolean, cache: null | 'miss' | 'hit' }

// the below reads using REST url (non-edge)
const get1 = await redis.get('key', {edge: false});
if (get1.error) throw get1.error;
} catch (error) {
console.error(error);
}
Expand Down

0 comments on commit 5593a18

Please sign in to comment.