We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 240d497 commit fb41810Copy full SHA for fb41810
README.md
@@ -74,3 +74,30 @@ import { get } from '@upstash/redis';
74
}
75
})();
76
```
77
+
78
+### Edge Support
79
80
+> Only GET requests are supported in Edge Caching. As a result, write/update commands are not supported.
81
82
+```typescript
83
+import upstash from '@upstash/redis';
84
85
+const redis = upstash({
86
+ url: 'UPSTASH_REDIS_REST_URL',
87
+ token: 'UPSTASH_REDIS_REST_TOKEN',
88
+ edgeUrl: 'UPSTASH_REDIS_EDGE_URL',
89
+});
90
91
+(async () => {
92
+ try {
93
+ const { data, error, metadata } = await redis.get('key');
94
+ if (error) throw error;
95
+ console.log(data);
96
+ // -> null | string
97
+ console.log(metadata);
98
+ // -> { edge: boolean, cache: null | 'miss' | 'hit' }
99
+ } catch (error) {
100
+ console.error(error);
101
+ }
102
+})();
103
+```
0 commit comments