File size: 749 Bytes
126a6a1
 
 
a8d7371
126a6a1
a8d7371
126a6a1
 
 
a8d7371
 
126a6a1
a8d7371
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126a6a1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import {Redis} from "@upstash/redis";

const redis = new Redis({
  url: "http://127.0.0.1:8080",
  token: "example_token",
  // responseEncoding: true,
});

(async () => {
  // await redis.set("key", "value");
  const value = await redis.get("foo");
  console.log(value); // value

  // Run a pipeline operation
  const pipelineResponse = await redis.pipeline()
    .set("amazing-key", "bar")
    .get("amazing-key")
    .del("amazing-other-key")
    .del("random-key-that-doesnt-exist")
    .srandmember("random-key-that-doesnt-exist")
    .sadd("amazing-set", "item1", "item2", "item3", "bar", "foo", "example")
    .smembers("amazing-set")
    // .evalsha("aijsojiasd", [], [])
    .get("foo")
    .exec();

  console.log(pipelineResponse);
})();