Spaces:
Sleeping
Sleeping
hiett
commited on
Commit
·
401768e
1
Parent(s):
2569db8
Minor cleaning
Browse files- .github/workflows/test.yml +0 -4
- example/src/index.ts +12 -4
.github/workflows/test.yml
CHANGED
|
@@ -26,10 +26,6 @@ jobs:
|
|
| 26 |
with:
|
| 27 |
repository: upstash/upstash-redis
|
| 28 |
|
| 29 |
-
# - uses: denoland/setup-deno@v1
|
| 30 |
-
# with:
|
| 31 |
-
# deno-version: v1.x
|
| 32 |
-
|
| 33 |
- name: Run @upstash/redis Test Suite
|
| 34 |
run: deno test -A ./pkg
|
| 35 |
env:
|
|
|
|
| 26 |
with:
|
| 27 |
repository: upstash/upstash-redis
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
- name: Run @upstash/redis Test Suite
|
| 30 |
run: deno test -A ./pkg
|
| 31 |
env:
|
example/src/index.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
| 1 |
import {Redis} from "@upstash/redis";
|
| 2 |
|
| 3 |
const redis = new Redis({
|
|
|
|
| 4 |
url: "http://127.0.0.1:8080",
|
|
|
|
|
|
|
| 5 |
token: "example_token",
|
| 6 |
-
// responseEncoding: true,
|
| 7 |
});
|
| 8 |
|
| 9 |
(async () => {
|
| 10 |
-
|
| 11 |
const value = await redis.get("foo");
|
| 12 |
-
console.log(value);
|
| 13 |
|
| 14 |
// Run a pipeline operation
|
| 15 |
const pipelineResponse = await redis.pipeline()
|
|
@@ -20,9 +22,15 @@ const redis = new Redis({
|
|
| 20 |
.srandmember("random-key-that-doesnt-exist")
|
| 21 |
.sadd("amazing-set", "item1", "item2", "item3", "bar", "foo", "example")
|
| 22 |
.smembers("amazing-set")
|
| 23 |
-
// .evalsha("aijsojiasd", [], [])
|
| 24 |
.get("foo")
|
| 25 |
.exec();
|
| 26 |
|
| 27 |
console.log(pipelineResponse);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
})();
|
|
|
|
| 1 |
import {Redis} from "@upstash/redis";
|
| 2 |
|
| 3 |
const redis = new Redis({
|
| 4 |
+
// The URL of the SRH instance
|
| 5 |
url: "http://127.0.0.1:8080",
|
| 6 |
+
|
| 7 |
+
// The token you defined in tokens.json
|
| 8 |
token: "example_token",
|
|
|
|
| 9 |
});
|
| 10 |
|
| 11 |
(async () => {
|
| 12 |
+
await redis.set("foo", "bar");
|
| 13 |
const value = await redis.get("foo");
|
| 14 |
+
console.log(value);
|
| 15 |
|
| 16 |
// Run a pipeline operation
|
| 17 |
const pipelineResponse = await redis.pipeline()
|
|
|
|
| 22 |
.srandmember("random-key-that-doesnt-exist")
|
| 23 |
.sadd("amazing-set", "item1", "item2", "item3", "bar", "foo", "example")
|
| 24 |
.smembers("amazing-set")
|
|
|
|
| 25 |
.get("foo")
|
| 26 |
.exec();
|
| 27 |
|
| 28 |
console.log(pipelineResponse);
|
| 29 |
+
|
| 30 |
+
const multiExecResponse = await redis.multi()
|
| 31 |
+
.set("example", "value")
|
| 32 |
+
.get("example")
|
| 33 |
+
.exec();
|
| 34 |
+
|
| 35 |
+
console.log(multiExecResponse);
|
| 36 |
})();
|