@upstash/redis 1.0.0-alpha.2 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/chunk-7YUZYRJS.mjs → chunk-7YUZYRJS.mjs} +0 -0
- package/{dist/chunk-FJSI5EBJ.mjs → chunk-FJSI5EBJ.mjs} +0 -0
- package/{dist/chunk-U7OXAQMQ.mjs → chunk-U7OXAQMQ.mjs} +0 -0
- package/{dist/chunk-Y5TC4HX2.mjs → chunk-Y5TC4HX2.mjs} +0 -0
- package/{dist/chunk-ZIB6XPPC.mjs → chunk-ZIB6XPPC.mjs} +0 -0
- package/{dist/cloudflare.d.ts → cloudflare.d.ts} +0 -0
- package/{dist/cloudflare.js → cloudflare.js} +0 -0
- package/{dist/cloudflare.mjs → cloudflare.mjs} +0 -0
- package/{dist/commands.d.ts → commands.d.ts} +0 -0
- package/{dist/commands.js → commands.js} +0 -0
- package/{dist/commands.mjs → commands.mjs} +0 -0
- package/{dist/fastly.d.ts → fastly.d.ts} +0 -0
- package/{dist/fastly.js → fastly.js} +0 -0
- package/{dist/fastly.mjs → fastly.mjs} +0 -0
- package/{dist/http.d.ts → http.d.ts} +0 -0
- package/{dist/http.js → http.js} +0 -0
- package/{dist/http.mjs → http.mjs} +0 -0
- package/{dist/index.d.ts → index.d.ts} +0 -0
- package/{dist/index.js → index.js} +0 -0
- package/{dist/index.mjs → index.mjs} +0 -0
- package/{dist/nodejs.d.ts → nodejs.d.ts} +0 -0
- package/{dist/nodejs.js → nodejs.js} +0 -0
- package/{dist/nodejs.mjs → nodejs.mjs} +0 -0
- package/package.json +1 -1
- package/{dist/redis-dd052782.d.ts → redis-dd052782.d.ts} +0 -0
- package/{dist/zunionstore-dffa797d.d.ts → zunionstore-dffa797d.d.ts} +0 -0
- package/.eslintrc.js +0 -49
- package/.prettierrc.js +0 -7
- package/LICENSE +0 -21
- package/dist/package.json +0 -1
- package/jest.config.js +0 -195
- package/pkg/cloudflare.ts +0 -77
- package/pkg/command.ts +0 -40
- package/pkg/commands/append.test.ts +0 -28
- package/pkg/commands/append.ts +0 -10
- package/pkg/commands/bitcount.test.ts +0 -36
- package/pkg/commands/bitcount.ts +0 -19
- package/pkg/commands/bitop.test.ts +0 -44
- package/pkg/commands/bitop.ts +0 -22
- package/pkg/commands/bitpos.test.ts +0 -26
- package/pkg/commands/bitpos.ts +0 -10
- package/pkg/commands/dbsize.test.ts +0 -17
- package/pkg/commands/dbsize.ts +0 -10
- package/pkg/commands/decr.test.ts +0 -22
- package/pkg/commands/decr.ts +0 -10
- package/pkg/commands/decrby.test.ts +0 -23
- package/pkg/commands/decrby.ts +0 -10
- package/pkg/commands/del.test.ts +0 -38
- package/pkg/commands/del.ts +0 -11
- package/pkg/commands/echo.test.ts +0 -11
- package/pkg/commands/echo.ts +0 -10
- package/pkg/commands/exists.test.ts +0 -37
- package/pkg/commands/exists.ts +0 -11
- package/pkg/commands/expire.test.ts +0 -22
- package/pkg/commands/expire.ts +0 -10
- package/pkg/commands/expireat.test.ts +0 -24
- package/pkg/commands/expireat.ts +0 -10
- package/pkg/commands/flushall.test.ts +0 -17
- package/pkg/commands/flushall.ts +0 -13
- package/pkg/commands/flushdb.test.ts +0 -17
- package/pkg/commands/flushdb.ts +0 -13
- package/pkg/commands/get.test.ts +0 -34
- package/pkg/commands/get.ts +0 -10
- package/pkg/commands/getbit.test.ts +0 -16
- package/pkg/commands/getbit.ts +0 -10
- package/pkg/commands/getrange.test.ts +0 -25
- package/pkg/commands/getrange.ts +0 -10
- package/pkg/commands/getset.test.ts +0 -33
- package/pkg/commands/getset.ts +0 -10
- package/pkg/commands/hdel.test.ts +0 -30
- package/pkg/commands/hdel.ts +0 -10
- package/pkg/commands/hexists.test.ts +0 -31
- package/pkg/commands/hexists.ts +0 -10
- package/pkg/commands/hget.test.ts +0 -47
- package/pkg/commands/hget.ts +0 -10
- package/pkg/commands/hgetall.test.ts +0 -32
- package/pkg/commands/hgetall.ts +0 -35
- package/pkg/commands/hincrby.test.ts +0 -27
- package/pkg/commands/hincrby.ts +0 -10
- package/pkg/commands/hincrbyfloat.test.ts +0 -25
- package/pkg/commands/hincrbyfloat.ts +0 -10
- package/pkg/commands/hkeys.test.ts +0 -22
- package/pkg/commands/hkeys.ts +0 -10
- package/pkg/commands/hlen.test.ts +0 -24
- package/pkg/commands/hlen.ts +0 -10
- package/pkg/commands/hmget.test.ts +0 -48
- package/pkg/commands/hmget.ts +0 -41
- package/pkg/commands/hmset.test.ts +0 -24
- package/pkg/commands/hmset.ts +0 -10
- package/pkg/commands/hscan.test.ts +0 -46
- package/pkg/commands/hscan.ts +0 -22
- package/pkg/commands/hset.test.ts +0 -21
- package/pkg/commands/hset.ts +0 -10
- package/pkg/commands/hsetnx.test.ts +0 -37
- package/pkg/commands/hsetnx.ts +0 -10
- package/pkg/commands/hstrlen.test.ts +0 -24
- package/pkg/commands/hstrlen.ts +0 -10
- package/pkg/commands/hvals.test.ts +0 -23
- package/pkg/commands/hvals.ts +0 -10
- package/pkg/commands/incr.test.ts +0 -23
- package/pkg/commands/incr.ts +0 -10
- package/pkg/commands/incrby.test.ts +0 -23
- package/pkg/commands/incrby.ts +0 -10
- package/pkg/commands/incrbyfloat.test.ts +0 -24
- package/pkg/commands/incrbyfloat.ts +0 -10
- package/pkg/commands/index.ts +0 -107
- package/pkg/commands/keys.test.ts +0 -17
- package/pkg/commands/keys.ts +0 -10
- package/pkg/commands/lindex.test.ts +0 -33
- package/pkg/commands/lindex.ts +0 -7
- package/pkg/commands/linsert.test.ts +0 -19
- package/pkg/commands/linsert.ts +0 -6
- package/pkg/commands/llen.test.ts +0 -26
- package/pkg/commands/llen.ts +0 -10
- package/pkg/commands/lpop.test.ts +0 -27
- package/pkg/commands/lpop.ts +0 -10
- package/pkg/commands/lpush.test.ts +0 -17
- package/pkg/commands/lpush.ts +0 -11
- package/pkg/commands/lpushx.test.ts +0 -29
- package/pkg/commands/lpushx.ts +0 -11
- package/pkg/commands/lrange.test.ts +0 -22
- package/pkg/commands/lrange.ts +0 -7
- package/pkg/commands/lrem.test.ts +0 -19
- package/pkg/commands/lrem.ts +0 -6
- package/pkg/commands/lset.test.ts +0 -40
- package/pkg/commands/lset.ts +0 -7
- package/pkg/commands/ltrim.test.ts +0 -29
- package/pkg/commands/ltrim.ts +0 -7
- package/pkg/commands/mget.test.ts +0 -44
- package/pkg/commands/mget.ts +0 -9
- package/pkg/commands/mset.test.ts +0 -24
- package/pkg/commands/mset.ts +0 -10
- package/pkg/commands/msetnx.test.ts +0 -46
- package/pkg/commands/msetnx.ts +0 -10
- package/pkg/commands/persist.test.ts +0 -22
- package/pkg/commands/persist.ts +0 -10
- package/pkg/commands/pexpire.test.ts +0 -24
- package/pkg/commands/pexpire.ts +0 -10
- package/pkg/commands/pexpireat.test.ts +0 -24
- package/pkg/commands/pexpireat.ts +0 -10
- package/pkg/commands/ping.test.ts +0 -19
- package/pkg/commands/ping.ts +0 -13
- package/pkg/commands/psetex.test.ts +0 -23
- package/pkg/commands/psetex.ts +0 -10
- package/pkg/commands/pttl.test.ts +0 -17
- package/pkg/commands/pttl.ts +0 -10
- package/pkg/commands/randomkey.test.ts +0 -17
- package/pkg/commands/randomkey.ts +0 -10
- package/pkg/commands/rename.test.ts +0 -18
- package/pkg/commands/rename.ts +0 -10
- package/pkg/commands/renamenx.test.ts +0 -32
- package/pkg/commands/renamenx.ts +0 -10
- package/pkg/commands/rpop.test.ts +0 -27
- package/pkg/commands/rpop.ts +0 -10
- package/pkg/commands/rpush.test.ts +0 -17
- package/pkg/commands/rpush.ts +0 -11
- package/pkg/commands/rpushx.test.ts +0 -29
- package/pkg/commands/rpushx.ts +0 -11
- package/pkg/commands/sadd.test.ts +0 -16
- package/pkg/commands/sadd.ts +0 -11
- package/pkg/commands/scan.test.ts +0 -50
- package/pkg/commands/scan.ts +0 -21
- package/pkg/commands/scard.test.ts +0 -15
- package/pkg/commands/scard.ts +0 -9
- package/pkg/commands/sdiff.test.ts +0 -20
- package/pkg/commands/sdiff.ts +0 -9
- package/pkg/commands/sdiffstore.test.ts +0 -21
- package/pkg/commands/sdiffstore.ts +0 -10
- package/pkg/commands/set.test.ts +0 -112
- package/pkg/commands/set.ts +0 -53
- package/pkg/commands/setbit.test.ts +0 -16
- package/pkg/commands/setbit.ts +0 -10
- package/pkg/commands/setex.test.ts +0 -22
- package/pkg/commands/setex.ts +0 -10
- package/pkg/commands/setnx.test.ts +0 -27
- package/pkg/commands/setnx.ts +0 -10
- package/pkg/commands/setrange.test.ts +0 -25
- package/pkg/commands/setrange.ts +0 -10
- package/pkg/commands/sinter.test.ts +0 -36
- package/pkg/commands/sinter.ts +0 -9
- package/pkg/commands/sinterstore.test.ts +0 -21
- package/pkg/commands/sinterstore.ts +0 -9
- package/pkg/commands/sismember.test.ts +0 -30
- package/pkg/commands/sismember.ts +0 -9
- package/pkg/commands/smembers.test.ts +0 -22
- package/pkg/commands/smembers.ts +0 -10
- package/pkg/commands/smove.test.ts +0 -18
- package/pkg/commands/smove.ts +0 -9
- package/pkg/commands/spop.test.ts +0 -35
- package/pkg/commands/spop.ts +0 -13
- package/pkg/commands/srandmember.test.ts +0 -32
- package/pkg/commands/srandmember.ts +0 -13
- package/pkg/commands/srem.test.ts +0 -18
- package/pkg/commands/srem.ts +0 -10
- package/pkg/commands/sscan.test.ts +0 -50
- package/pkg/commands/sscan.ts +0 -22
- package/pkg/commands/strlen.test.ts +0 -16
- package/pkg/commands/strlen.ts +0 -10
- package/pkg/commands/sunion.test.ts +0 -22
- package/pkg/commands/sunion.ts +0 -10
- package/pkg/commands/sunionstore.test.ts +0 -29
- package/pkg/commands/sunionstore.ts +0 -10
- package/pkg/commands/time.test.ts +0 -11
- package/pkg/commands/time.ts +0 -9
- package/pkg/commands/touch.test.ts +0 -20
- package/pkg/commands/touch.ts +0 -10
- package/pkg/commands/ttl.test.ts +0 -17
- package/pkg/commands/ttl.ts +0 -10
- package/pkg/commands/type.test.ts +0 -72
- package/pkg/commands/type.ts +0 -11
- package/pkg/commands/unlink.test.ts +0 -21
- package/pkg/commands/unlink.ts +0 -10
- package/pkg/commands/zadd.test.ts +0 -177
- package/pkg/commands/zadd.ts +0 -64
- package/pkg/commands/zcard.test.ts +0 -15
- package/pkg/commands/zcard.ts +0 -10
- package/pkg/commands/zcount.test.ts +0 -15
- package/pkg/commands/zcount.ts +0 -9
- package/pkg/commands/zincrby.test.ts +0 -20
- package/pkg/commands/zincrby.ts +0 -9
- package/pkg/commands/zinterstore.test.ts +0 -239
- package/pkg/commands/zinterstore.ts +0 -55
- package/pkg/commands/zlexcount.test.ts +0 -22
- package/pkg/commands/zlexcount.ts +0 -9
- package/pkg/commands/zpopmax.test.ts +0 -45
- package/pkg/commands/zpopmax.ts +0 -13
- package/pkg/commands/zpopmin.test.ts +0 -49
- package/pkg/commands/zpopmin.ts +0 -13
- package/pkg/commands/zrange.test.ts +0 -52
- package/pkg/commands/zrange.ts +0 -22
- package/pkg/commands/zrank.test.ts +0 -22
- package/pkg/commands/zrank.ts +0 -10
- package/pkg/commands/zrem.test.ts +0 -20
- package/pkg/commands/zrem.ts +0 -10
- package/pkg/commands/zremrangebylex.test.ts +0 -26
- package/pkg/commands/zremrangebylex.ts +0 -9
- package/pkg/commands/zremrangebyrank.test.ts +0 -27
- package/pkg/commands/zremrangebyrank.ts +0 -9
- package/pkg/commands/zremrangebyscore.test.ts +0 -24
- package/pkg/commands/zremrangebyscore.ts +0 -9
- package/pkg/commands/zrevrank.test.ts +0 -22
- package/pkg/commands/zrevrank.ts +0 -10
- package/pkg/commands/zscan.test.ts +0 -50
- package/pkg/commands/zscan.ts +0 -22
- package/pkg/commands/zscore.test.ts +0 -18
- package/pkg/commands/zscore.ts +0 -10
- package/pkg/commands/zunionstore.test.ts +0 -215
- package/pkg/commands/zunionstore.ts +0 -55
- package/pkg/commands/zz.ts +0 -1
- package/pkg/error.ts +0 -9
- package/pkg/fastly.ts +0 -54
- package/pkg/http.test.ts +0 -34
- package/pkg/http.ts +0 -62
- package/pkg/index.ts +0 -2
- package/pkg/nodejs.ts +0 -83
- package/pkg/pipeline.test.ts +0 -177
- package/pkg/pipeline.ts +0 -999
- package/pkg/redis.ts +0 -930
- package/pkg/test-utils.ts +0 -41
- package/pkg/types.ts +0 -4
- package/pkg/util.ts +0 -22
- package/pnpm-lock.yaml +0 -3940
- package/tsconfig.json +0 -100
- package/tsconfig.module.json +0 -8
- package/tsup.config.ts +0 -16
package/pkg/nodejs.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import * as core from "./redis"
|
|
2
|
-
import { HttpClient } from "./http"
|
|
3
|
-
import "isomorphic-fetch"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Connection credentials for upstash redis.
|
|
7
|
-
* Get them from https://console.upstash.com/redis/<uuid>
|
|
8
|
-
*/
|
|
9
|
-
export type RedisConfigNodejs = {
|
|
10
|
-
/**
|
|
11
|
-
* UPSTASH_REDIS_REST_URL
|
|
12
|
-
*/
|
|
13
|
-
url: string
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* UPSTASH_REDIS_REST_TOKEN
|
|
17
|
-
*/
|
|
18
|
-
token: string
|
|
19
|
-
|
|
20
|
-
// requestOptions?: {
|
|
21
|
-
// /**
|
|
22
|
-
// * **fastly only**
|
|
23
|
-
// *
|
|
24
|
-
// * A Request can be forwarded to any backend defined on your service. Backends
|
|
25
|
-
// * can be created via the Fastly CLI, API, or web interface, and are
|
|
26
|
-
// * referenced by name.
|
|
27
|
-
// */
|
|
28
|
-
// backend?: string
|
|
29
|
-
// }
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Serverless redis client for upstash.
|
|
34
|
-
*/
|
|
35
|
-
export class Redis extends core.Redis {
|
|
36
|
-
/**
|
|
37
|
-
* Create a new redis client
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* const redis = new Redis({
|
|
42
|
-
* url: "<UPSTASH_REDIS_REST_URL>",
|
|
43
|
-
* token: "<UPSTASH_REDIS_REST_TOKEN>",
|
|
44
|
-
* });
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
constructor(config: RedisConfigNodejs) {
|
|
48
|
-
const client = new HttpClient({
|
|
49
|
-
baseUrl: config.url,
|
|
50
|
-
headers: {
|
|
51
|
-
authorization: `Bearer ${config.token}`,
|
|
52
|
-
},
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
super(client)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Create a new Upstash Redis instance from environment variables.
|
|
60
|
-
*
|
|
61
|
-
* Use this to automatically load connection secrets from your environment
|
|
62
|
-
* variables. For instance when using the Vercel integration.
|
|
63
|
-
*
|
|
64
|
-
* This tries to load `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` from
|
|
65
|
-
* your environment using `process.env`.
|
|
66
|
-
*/
|
|
67
|
-
static fromEnv(): Redis {
|
|
68
|
-
if (typeof process?.env === "undefined") {
|
|
69
|
-
throw new Error(
|
|
70
|
-
"Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please use `Redis.onCloudflare()` instead",
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
const url = process.env["UPSTASH_REDIS_REST_URL"]
|
|
74
|
-
if (!url) {
|
|
75
|
-
throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`")
|
|
76
|
-
}
|
|
77
|
-
const token = process.env["UPSTASH_REDIS_REST_TOKEN"]
|
|
78
|
-
if (!token) {
|
|
79
|
-
throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`")
|
|
80
|
-
}
|
|
81
|
-
return new Redis({ url, token })
|
|
82
|
-
}
|
|
83
|
-
}
|
package/pkg/pipeline.test.ts
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { Pipeline } from "./pipeline"
|
|
2
|
-
import { keygen, newHttpClient } from "./test-utils"
|
|
3
|
-
import { randomUUID } from "crypto"
|
|
4
|
-
import { describe, it, expect, afterEach } from "@jest/globals"
|
|
5
|
-
const client = newHttpClient()
|
|
6
|
-
|
|
7
|
-
const { newKey, cleanup } = keygen()
|
|
8
|
-
afterEach(cleanup)
|
|
9
|
-
|
|
10
|
-
describe("with single command", () => {
|
|
11
|
-
it("works with multiple commands", async () => {
|
|
12
|
-
const p = new Pipeline(client)
|
|
13
|
-
p.set(newKey(), randomUUID())
|
|
14
|
-
const res = await p.exec()
|
|
15
|
-
expect(res).toHaveLength(1)
|
|
16
|
-
expect(res[0]).toBe("OK")
|
|
17
|
-
})
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
describe("when chaining in a for loop", () => {
|
|
21
|
-
it("works", async () => {
|
|
22
|
-
const key = newKey()
|
|
23
|
-
const res = await new Pipeline(client).set(key, randomUUID()).get(key).exec()
|
|
24
|
-
|
|
25
|
-
expect(res).toHaveLength(2)
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
describe("when chaining inline", () => {
|
|
30
|
-
it("works", async () => {
|
|
31
|
-
const key = newKey()
|
|
32
|
-
const p = new Pipeline(client)
|
|
33
|
-
for (let i = 0; i < 10; i++) {
|
|
34
|
-
p.set(key, randomUUID())
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const res = await p.exec()
|
|
38
|
-
expect(res).toHaveLength(10)
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
describe("when no commands were added", () => {
|
|
43
|
-
it("throws", async () => {
|
|
44
|
-
expect(() => new Pipeline(client).exec()).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
45
|
-
`"Pipeline is empty"`,
|
|
46
|
-
)
|
|
47
|
-
})
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
describe("when one command throws an error", () => {
|
|
51
|
-
it("throws", async () => {
|
|
52
|
-
const p = new Pipeline(client).set("key", "value").hget("key", "field")
|
|
53
|
-
expect(() => p.exec()).rejects.toThrowErrorMatchingInlineSnapshot(
|
|
54
|
-
`"Command 2 [ hget ] failed: WRONGTYPE Operation against a key holding the wrong kind of value"`,
|
|
55
|
-
)
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
describe("use all the things", () => {
|
|
60
|
-
it("works", async () => {
|
|
61
|
-
const p = new Pipeline(client)
|
|
62
|
-
|
|
63
|
-
const persistentKey = newKey()
|
|
64
|
-
const persistentKey2 = newKey()
|
|
65
|
-
|
|
66
|
-
p.append(newKey(), "hello")
|
|
67
|
-
.bitcount(newKey(), 0, 1)
|
|
68
|
-
.bitop("and", newKey(), newKey())
|
|
69
|
-
.bitpos(newKey(), 0, 1)
|
|
70
|
-
.dbsize()
|
|
71
|
-
.decr(newKey())
|
|
72
|
-
.decrby(newKey(), 1)
|
|
73
|
-
.del(newKey())
|
|
74
|
-
.echo("hello")
|
|
75
|
-
.exists(newKey())
|
|
76
|
-
.expire(newKey(), 5)
|
|
77
|
-
.expireat(newKey(), Math.floor(new Date().getTime() / 1000) + 60)
|
|
78
|
-
.flushall()
|
|
79
|
-
.flushdb()
|
|
80
|
-
.get(newKey())
|
|
81
|
-
.getbit(newKey(), 0)
|
|
82
|
-
.getrange(newKey(), 0, 1)
|
|
83
|
-
.getset(newKey(), "hello")
|
|
84
|
-
.hdel(newKey(), "field")
|
|
85
|
-
.hexists(newKey(), "field")
|
|
86
|
-
.hget(newKey(), "field")
|
|
87
|
-
.hgetall(newKey())
|
|
88
|
-
.hincrby(newKey(), "field", 1)
|
|
89
|
-
.hincrbyfloat(newKey(), "field", 1.5)
|
|
90
|
-
.hkeys(newKey())
|
|
91
|
-
.hlen(newKey())
|
|
92
|
-
.hmget(newKey(), newKey())
|
|
93
|
-
.hmset(newKey(), { field: "field", value: "value" })
|
|
94
|
-
.hscan(newKey(), 0)
|
|
95
|
-
.hset(newKey(), "field", "value")
|
|
96
|
-
.hsetnx(newKey(), "field", "value")
|
|
97
|
-
.hstrlen(newKey(), "field")
|
|
98
|
-
.hvals(newKey())
|
|
99
|
-
.incr(newKey())
|
|
100
|
-
.incrby(newKey(), 1)
|
|
101
|
-
.incrbyfloat(newKey(), 1.5)
|
|
102
|
-
.keys("*")
|
|
103
|
-
.lindex(newKey(), 0)
|
|
104
|
-
.linsert(newKey(), "before", "pivot", "value")
|
|
105
|
-
.llen(newKey())
|
|
106
|
-
.lpop(newKey())
|
|
107
|
-
.lpush(persistentKey, "element")
|
|
108
|
-
.lpushx(newKey(), "element1", "element2")
|
|
109
|
-
.lrange(newKey(), 0, 1)
|
|
110
|
-
.lrem(newKey(), 1, "value")
|
|
111
|
-
.lset(persistentKey, "value", 0)
|
|
112
|
-
.ltrim(newKey(), 0, 1)
|
|
113
|
-
.mget<[string, string]>(newKey(), newKey())
|
|
114
|
-
.mset({ key1: "value", key2: "value" })
|
|
115
|
-
.msetnx({ key3: "value", key4: "value" })
|
|
116
|
-
.persist(newKey())
|
|
117
|
-
.pexpire(newKey(), 1000)
|
|
118
|
-
.pexpireat(newKey(), new Date().getTime() + 1000)
|
|
119
|
-
.ping()
|
|
120
|
-
.psetex(newKey(), 1, "value")
|
|
121
|
-
.pttl(newKey())
|
|
122
|
-
.randomkey()
|
|
123
|
-
.rename(persistentKey, persistentKey2)
|
|
124
|
-
.renamenx(persistentKey2, newKey())
|
|
125
|
-
.rpop(newKey())
|
|
126
|
-
.rpush(newKey(), "element1", "element2")
|
|
127
|
-
.rpushx(newKey(), "element1", "element2")
|
|
128
|
-
.sadd(newKey(), "memeber1", "member2")
|
|
129
|
-
.scan(0)
|
|
130
|
-
.scard(newKey())
|
|
131
|
-
.sdiff(newKey())
|
|
132
|
-
.sdiffstore(newKey(), newKey())
|
|
133
|
-
.set(newKey(), "value")
|
|
134
|
-
.setbit(newKey(), 1, 1)
|
|
135
|
-
.setex(newKey(), 1, "value")
|
|
136
|
-
.setnx(newKey(), "value")
|
|
137
|
-
.setrange(newKey(), 1, "value")
|
|
138
|
-
.sinter(newKey(), newKey())
|
|
139
|
-
.sinterstore(newKey(), newKey())
|
|
140
|
-
.sismember(newKey(), "member")
|
|
141
|
-
.smembers(newKey())
|
|
142
|
-
.smove(newKey(), newKey(), "member")
|
|
143
|
-
.spop(newKey())
|
|
144
|
-
.srandmember(newKey())
|
|
145
|
-
.srem(newKey(), "member")
|
|
146
|
-
.sscan(newKey(), 0)
|
|
147
|
-
.strlen(newKey())
|
|
148
|
-
.sunion(newKey())
|
|
149
|
-
.sunionstore(newKey(), newKey())
|
|
150
|
-
.time()
|
|
151
|
-
.touch()
|
|
152
|
-
.ttl(newKey())
|
|
153
|
-
.type(newKey())
|
|
154
|
-
.unlink()
|
|
155
|
-
.zadd(newKey(), { score: 0, member: "member" })
|
|
156
|
-
.zcard(newKey())
|
|
157
|
-
.zcount(newKey(), 0, 1)
|
|
158
|
-
.zincrby(newKey(), 1, "member")
|
|
159
|
-
.zinterstore(newKey(), 1, [newKey()])
|
|
160
|
-
.zlexcount(newKey(), "-", "+")
|
|
161
|
-
.zpopmax(newKey())
|
|
162
|
-
.zpopmin(newKey())
|
|
163
|
-
.zrange(newKey(), 0, 1)
|
|
164
|
-
.zrank(newKey(), "member")
|
|
165
|
-
.zrem(newKey(), "member")
|
|
166
|
-
.zremrangebylex(newKey(), "-", "+")
|
|
167
|
-
.zremrangebyrank(newKey(), 0, 1)
|
|
168
|
-
.zremrangebyscore(newKey(), 0, 1)
|
|
169
|
-
.zrevrank(newKey(), "member")
|
|
170
|
-
.zscan(newKey(), 0)
|
|
171
|
-
.zscore(newKey(), "member")
|
|
172
|
-
.zunionstore(newKey(), 1, [newKey()])
|
|
173
|
-
|
|
174
|
-
const res = await p.exec()
|
|
175
|
-
expect(res).toHaveLength(107)
|
|
176
|
-
})
|
|
177
|
-
})
|