File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -74,3 +74,30 @@ import { get } from '@upstash/redis';
74
74
}
75
75
})();
76
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
+ ```
You can’t perform that action at this time.
0 commit comments