@baeta/cache-ioredis 2.0.0-next.14 → 2.0.0-next.16
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/CHANGELOG.md +24 -16
- package/README.md +31 -23
- package/dist/index.js +33 -30
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
# @baeta/cache-ioredis
|
|
2
2
|
|
|
3
|
-
## 2.0.0-next.
|
|
3
|
+
## 2.0.0-next.16
|
|
4
4
|
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
- Updated dependencies:
|
|
8
|
-
- @baeta/cache@2.0.0-next.14
|
|
5
|
+
### Major Changes
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
- The ioredis adapter was renamed from `@baeta/extension-cache-redis` to `@baeta/cache-ioredis` and rebuilt for the decoupled v2 cache API. Instead of the old `RedisStore` (a Baeta `Store`), it now exports a `RedisCacheClient` that extends the `CacheClient` base class from `@baeta/cache` and is passed directly to `createCache`. by [@andreisergiu98](https://github.com/andreisergiu98) in [#290](https://github.com/andreisergiu98/baeta/pull/290)
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
```typescript
|
|
10
|
+
// v1
|
|
11
|
+
import { cacheExtension } from "@baeta/extension-cache";
|
|
12
|
+
import { RedisStore } from "@baeta/extension-cache-redis";
|
|
13
|
+
import Redis from "ioredis";
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
const redisStore = new RedisStore(new Redis("redis://localhost:6379"));
|
|
16
|
+
export const cacheExt = cacheExtension(redisStore, { ttl: 3600 });
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
// v2
|
|
19
|
+
import { createCache } from "@baeta/cache";
|
|
20
|
+
import { RedisCacheClient } from "@baeta/cache-ioredis";
|
|
21
|
+
import Redis from "ioredis";
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
export const redisClient = new RedisCacheClient(
|
|
24
|
+
new Redis("redis://localhost:6379")
|
|
25
|
+
);
|
|
26
|
+
// pass redisClient to createCache(redisClient, { ... })
|
|
27
|
+
```
|
|
20
28
|
|
|
21
|
-
|
|
29
|
+
`RedisCacheClient` accepts both a standalone `Redis` and a `Cluster` connection, and exposes pipeline-batching tuning options (`maxPipelineSizeLimit`, `maxPipelineCommandLimit`, `maxCommandKeysLimit`) plus the shared `CacheClientOptions` (`ttlMs`, `revision`, `namespace`).
|
|
22
30
|
|
|
23
|
-
- [
|
|
31
|
+
- Drop support for Node.js v23 and v25. Baeta now targets the active LTS releases — Node.js `^22.20.0`, `^24.0.0`, or `>=26.0.0`. by [@andreisergiu98](https://github.com/andreisergiu98) in [#290](https://github.com/andreisergiu98/baeta/pull/290)
|
|
24
32
|
|
|
25
33
|
### Patch Changes
|
|
26
34
|
|
|
27
|
-
- Updated dependencies [[`
|
|
28
|
-
- @baeta/cache-redis-common@2.0.0-next.
|
|
29
|
-
- @baeta/cache@2.0.0-next.
|
|
35
|
+
- Updated dependencies [[`046dc5c`](https://github.com/andreisergiu98/baeta/commit/046dc5c29a8ec0f613b9430caa659c08d41a678c), [`046dc5c`](https://github.com/andreisergiu98/baeta/commit/046dc5c29a8ec0f613b9430caa659c08d41a678c), [`046dc5c`](https://github.com/andreisergiu98/baeta/commit/046dc5c29a8ec0f613b9430caa659c08d41a678c)]:
|
|
36
|
+
- @baeta/cache-redis-common@2.0.0-next.14
|
|
37
|
+
- @baeta/cache@2.0.0-next.16
|
package/README.md
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
<div align="center">
|
|
6
6
|
<h1>Baeta</h1>
|
|
7
7
|
<a href="https://www.npmjs.com/package/@baeta/cli"><img src="https://img.shields.io/npm/v/@baeta/cli.svg?style=flat" /></a>
|
|
8
|
-
<a href="https://github.com/andreisergiu98/baeta/actions/workflows/
|
|
8
|
+
<a href="https://github.com/andreisergiu98/baeta/actions/workflows/build.yml"><img src="https://img.shields.io/github/actions/workflow/status/andreisergiu98/baeta/build.yml" /></a>
|
|
9
9
|
<a href="https://github.com/andreisergiu98/baeta/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" /></a>
|
|
10
10
|
<a href="https://github.com/andreisergiu98/baeta/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" /></a>
|
|
11
|
+
<img alt="nycrc config on GitHub" src="https://img.shields.io/nycrc/andreisergiu98/baeta?config=.nycrc.json&preferredThreshold=branches&color=green">
|
|
11
12
|
<br />
|
|
12
13
|
<br />
|
|
13
14
|
<a href="https://baeta.io/docs/getting-started/installation">Getting Started</a>
|
|
@@ -35,10 +36,11 @@ Building GraphQL APIs shouldn't be complicated. **Baeta** is a modern, modular,
|
|
|
35
36
|
- **Middleware & Directives**: Easy integration of custom behaviors
|
|
36
37
|
- **High Performance**: Built for scalability and efficiency
|
|
37
38
|
|
|
38
|
-
#### And optional
|
|
39
|
+
#### And optional app plugins and libraries
|
|
39
40
|
|
|
40
|
-
- **@baeta/
|
|
41
|
-
- **@baeta/
|
|
41
|
+
- **@baeta/auth**: Add powerful scope-based authorization
|
|
42
|
+
- **@baeta/complexity**: Reject resource-exhausting queries with depth, breadth and complexity limits
|
|
43
|
+
- **@baeta/cache**: Type-safe caching with declarative queries and automatic reconciliation
|
|
42
44
|
- ... and more!
|
|
43
45
|
|
|
44
46
|
## Why use Baeta?
|
|
@@ -89,7 +91,7 @@ const usersQuery = Query.users.resolve(() => {
|
|
|
89
91
|
return dataSource.user.findMany();
|
|
90
92
|
});
|
|
91
93
|
|
|
92
|
-
Query.$fields({
|
|
94
|
+
export default Query.$fields({
|
|
93
95
|
user: userQuery,
|
|
94
96
|
users: usersQuery,
|
|
95
97
|
});
|
|
@@ -98,17 +100,13 @@ Query.$fields({
|
|
|
98
100
|
#### 3. Add authorization
|
|
99
101
|
|
|
100
102
|
```typescript
|
|
103
|
+
import { auth, rule, scope } from "./lib/auth.ts";
|
|
101
104
|
import { UserModule } from "./typedef.ts";
|
|
102
105
|
|
|
103
106
|
const { Query } = UserModule;
|
|
104
107
|
|
|
105
108
|
const userQuery = Query.user
|
|
106
|
-
.$auth(
|
|
107
|
-
$or: {
|
|
108
|
-
isPublic: true,
|
|
109
|
-
isLoggedIn: true,
|
|
110
|
-
},
|
|
111
|
-
})
|
|
109
|
+
.$use(auth(rule.or(scope.isPublic, scope.isLoggedIn)))
|
|
112
110
|
.resolve(async ({ args }) => {
|
|
113
111
|
// ...
|
|
114
112
|
});
|
|
@@ -117,23 +115,33 @@ const userQuery = Query.user
|
|
|
117
115
|
#### 4. Add caching
|
|
118
116
|
|
|
119
117
|
```typescript
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
import { createCache, defineQuery } from "@baeta/cache";
|
|
119
|
+
import { redisClient } from "./lib/redis.ts";
|
|
120
|
+
|
|
121
|
+
const { Query, Mutation } = UserModule;
|
|
122
|
+
|
|
123
|
+
export const userCache = createCache(redisClient, {
|
|
124
|
+
name: "UserCache",
|
|
125
|
+
parse: JSON.parse,
|
|
126
|
+
serialize: JSON.stringify,
|
|
127
|
+
})
|
|
128
|
+
.withQueries({
|
|
129
|
+
findUser: defineQuery({
|
|
130
|
+
resolve: async (args: { id: string }) => {
|
|
131
|
+
return dataSource.user.findUnique({ where: args });
|
|
132
|
+
},
|
|
133
|
+
}),
|
|
127
134
|
})
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
})
|
|
135
|
+
.build();
|
|
136
|
+
|
|
137
|
+
const userQuery = Query.user.map(({ args }) =>
|
|
138
|
+
userCache.queries.findUser({ id: args.where.id }),
|
|
139
|
+
);
|
|
132
140
|
|
|
133
141
|
const updateUserMutation = Mutation.updateUser
|
|
134
142
|
.$use(async (next) => {
|
|
135
143
|
const user = await next();
|
|
136
|
-
await userCache.
|
|
144
|
+
if (user) await userCache.update(user);
|
|
137
145
|
return user;
|
|
138
146
|
})
|
|
139
147
|
.resolve(async ({ args }) => {
|
package/dist/index.js
CHANGED
|
@@ -46,15 +46,10 @@ var RedisCacheClient = class extends CacheClient {
|
|
|
46
46
|
makePipeline: () => this.redis.pipeline(),
|
|
47
47
|
addCommand: (pipeline, item) => {
|
|
48
48
|
if (saveOptions.disableOverwrite !== true) pipeline.set(item.key, item.value, "PXAT", expiresAt);
|
|
49
|
-
else
|
|
50
|
-
pipeline.setnx(item.key, item.value);
|
|
51
|
-
pipeline.pexpireat(item.key, expiresAt);
|
|
52
|
-
}
|
|
49
|
+
else pipeline.set(item.key, item.value, "PXAT", expiresAt, "NX");
|
|
53
50
|
},
|
|
54
51
|
executePipeline: async (pipeline) => {
|
|
55
|
-
|
|
56
|
-
if (result == null) throw new Error("Unexpected null result from Redis pipeline");
|
|
57
|
-
assertNoPipelineErrors(result);
|
|
52
|
+
assertNoPipelineErrors(await pipeline.exec());
|
|
58
53
|
return [];
|
|
59
54
|
},
|
|
60
55
|
estimateSize: (item) => {
|
|
@@ -71,18 +66,19 @@ var RedisCacheClient = class extends CacheClient {
|
|
|
71
66
|
async saveItemsWithDiff(items, options) {
|
|
72
67
|
if (items.length === 0) return [];
|
|
73
68
|
const expiresAt = Date.now() + options.ttlMs;
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
values[i] = options.serialize(items[i][1]);
|
|
69
|
+
const tx = this.redis.multi();
|
|
70
|
+
for (const item of items) {
|
|
71
|
+
tx.get(item[0]);
|
|
72
|
+
tx.set(item[0], options.serialize(item[1]), "PXAT", expiresAt);
|
|
79
73
|
}
|
|
80
|
-
const result = await
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
const result = await tx.exec();
|
|
75
|
+
assertNoPipelineErrors(result);
|
|
76
|
+
const results = [];
|
|
77
|
+
for (let i = 0; i < result.length; i += 2) {
|
|
78
|
+
const value = result[i][1];
|
|
79
|
+
results.push(value == null ? null : options.parse(value));
|
|
80
|
+
}
|
|
81
|
+
return results;
|
|
86
82
|
}
|
|
87
83
|
async deleteItems(keys) {
|
|
88
84
|
if (keys.length === 0) return;
|
|
@@ -92,12 +88,19 @@ var RedisCacheClient = class extends CacheClient {
|
|
|
92
88
|
}
|
|
93
89
|
async deleteItemsWithDiff(keys, options) {
|
|
94
90
|
if (keys.length === 0) return [];
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
91
|
+
const tx = this.redis.multi();
|
|
92
|
+
for (const key of keys) {
|
|
93
|
+
tx.get(key);
|
|
94
|
+
tx.unlink(key);
|
|
95
|
+
}
|
|
96
|
+
const result = await tx.exec();
|
|
97
|
+
assertNoPipelineErrors(result);
|
|
98
|
+
const results = [];
|
|
99
|
+
for (let i = 0; i < result.length; i += 2) {
|
|
100
|
+
const value = result[i][1];
|
|
101
|
+
results.push(value == null ? null : options.parse(value));
|
|
102
|
+
}
|
|
103
|
+
return results;
|
|
101
104
|
}
|
|
102
105
|
async getQuery(key, options) {
|
|
103
106
|
const meta = await this.redis.get(key);
|
|
@@ -106,14 +109,14 @@ var RedisCacheClient = class extends CacheClient {
|
|
|
106
109
|
async saveQuery(key, indexes, metadata, options) {
|
|
107
110
|
const now = Date.now();
|
|
108
111
|
const expiresAt = now + options.ttlMs;
|
|
109
|
-
const
|
|
110
|
-
|
|
112
|
+
const tx = this.redis.multi();
|
|
113
|
+
tx.set(key, options.serialize(metadata), "PXAT", expiresAt);
|
|
111
114
|
for (const indexKey of indexes) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
tx.zadd(indexKey, expiresAt, key);
|
|
116
|
+
tx.zremrangebyscore(indexKey, "-inf", now - INDEX_BUFFER_MS);
|
|
117
|
+
tx.pexpireat(indexKey, expiresAt + INDEX_BUFFER_MS);
|
|
115
118
|
}
|
|
116
|
-
assertNoPipelineErrors(await
|
|
119
|
+
assertNoPipelineErrors(await tx.exec());
|
|
117
120
|
}
|
|
118
121
|
async deleteQueries(indexes) {
|
|
119
122
|
if (indexes.length === 0) return;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../lib/cache-client.ts"],"sourcesContent":["import {\n\tCacheClient,\n\ttype CacheClientSaveOptions,\n\ttype ItemCacheKey,\n\ttype QueryCacheIndexKey,\n\ttype QueryCacheKey,\n\ttype CacheClientArgs,\n\ttype CacheClientOptions,\n} from '@baeta/cache';\nimport {\n\tassertNoPipelineErrors,\n\tbatchPipeline,\n\tcreateRedisScripts,\n\ttype RedisScripts,\n} from '@baeta/cache-redis-common';\nimport { doBatched } from '@baeta/cache/sdk';\nimport type Redis from 'ioredis';\nimport type { Cluster as RedisCluster } from 'ioredis';\n\nconst INDEX_BUFFER_MS = 1_000;\nconst MAX_PIPELINE_SIZE_LIMIT = 50 * 1024 * 1024; // 50MB\nconst MAX_PIPELINE_COMMAND_LIMIT = 100_000;\nconst MAX_COMMAND_KEYS_LIMIT = 100_000;\n\nexport interface RedisCacheClientOptions extends CacheClientOptions {\n\t/**\n\t * Maximum total size of commands in a single pipeline batch. If the batch exceeds this size, it will be executed immediately.\n\t * @defaultValue 50 * 1024 * 1024 (50MB)\n\t */\n\tmaxPipelineSizeLimit?: number;\n\t/**\n\t * Maximum number of commands in a single pipeline batch. If the batch exceeds this number, it will be executed immediately.\n\t * @defaultValue 100_000\n\t */\n\tmaxPipelineCommandLimit?: number;\n\t/**\n\t * Maximum number of keys in a single command. If the number of keys exceeds this limit, multiple commands will be executed.\n\t * @defaultValue 100_000\n\t */\n\tmaxCommandKeysLimit?: number;\n}\n\nexport class RedisCacheClient extends CacheClient {\n\tredis: Redis | RedisCluster;\n\tprotected maxPipelineSizeLimit: number;\n\tprotected maxPipelineCommandLimit: number;\n\tprotected maxCommandKeysLimit: number;\n\tprotected scripts: RedisScripts;\n\n\tconstructor(redis: Redis | RedisCluster, options?: RedisCacheClientOptions) {\n\t\tsuper({\n\t\t\tnamespace: options?.namespace,\n\t\t\trevision: options?.revision,\n\t\t\tttlMs: options?.ttlMs,\n\t\t});\n\t\tthis.redis = redis;\n\t\tthis.maxPipelineSizeLimit = options?.maxPipelineSizeLimit ?? MAX_PIPELINE_SIZE_LIMIT;\n\t\tthis.maxPipelineCommandLimit = options?.maxPipelineCommandLimit ?? MAX_PIPELINE_COMMAND_LIMIT;\n\t\tthis.maxCommandKeysLimit = options?.maxCommandKeysLimit ?? MAX_COMMAND_KEYS_LIMIT;\n\t\tconst loadScript = async (script: string) => {\n\t\t\treturn await this.redis.script('LOAD', script);\n\t\t};\n\t\tconst evalSha = async (sha: string, keys: string[], args: string[]) => {\n\t\t\treturn await this.redis.evalsha(sha, keys.length, ...keys, ...args);\n\t\t};\n\t\tthis.scripts = createRedisScripts(loadScript, evalSha);\n\t}\n\n\tasync getPartialItems<Item>(\n\t\tkeys: ItemCacheKey[],\n\t\toptions: CacheClientArgs<Item>,\n\t): Promise<Array<Item | null>> {\n\t\tif (keys.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tconst values: Array<Item | null> = [];\n\t\tawait doBatched(keys, this.maxCommandKeysLimit, async (batch) => {\n\t\t\tconst batchValues = await this.redis.mget(batch);\n\t\t\tfor (const value of batchValues) {\n\t\t\t\tvalues.push(value == null ? null : options.parse(value));\n\t\t\t}\n\t\t});\n\t\treturn values;\n\t}\n\n\tasync saveItems<Item>(\n\t\titems: Array<[ItemCacheKey, Item]>,\n\t\toptions: CacheClientArgs<Item>,\n\t\tsaveOptions: CacheClientSaveOptions = {},\n\t): Promise<void> {\n\t\tif (items.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst expiresAt = Date.now() + options.ttlMs;\n\t\tconst serialized = items.map(([key, value]) => ({\n\t\t\tkey,\n\t\t\tvalue: options.serialize(value),\n\t\t}));\n\t\tawait batchPipeline({\n\t\t\tmakePipeline: () => this.redis.pipeline(),\n\t\t\taddCommand: (pipeline, item) => {\n\t\t\t\tif (saveOptions.disableOverwrite !== true) {\n\t\t\t\t\tpipeline.set(item.key, item.value, 'PXAT', expiresAt);\n\t\t\t\t} else {\n\t\t\t\t\tpipeline.setnx(item.key, item.value);\n\t\t\t\t\tpipeline.pexpireat(item.key, expiresAt);\n\t\t\t\t}\n\t\t\t},\n\t\t\texecutePipeline: async (pipeline) => {\n\t\t\t\tconst result = await pipeline.exec();\n\t\t\t\tif (result == null) {\n\t\t\t\t\tthrow new Error('Unexpected null result from Redis pipeline');\n\t\t\t\t}\n\t\t\t\tassertNoPipelineErrors(result);\n\t\t\t\treturn [];\n\t\t\t},\n\t\t\testimateSize: (item) => {\n\t\t\t\treturn item.key.length + item.value.length;\n\t\t\t},\n\t\t\titems: serialized,\n\t\t\tmaxBatchBytes: this.maxPipelineSizeLimit,\n\t\t\tmaxBatchCount: this.maxPipelineCommandLimit,\n\t\t});\n\t}\n\n\tasync saveItemsWithDiff<Item>(\n\t\titems: Array<[ItemCacheKey, Item]>,\n\t\toptions: CacheClientArgs<Item>,\n\t): Promise<Array<Item | null>> {\n\t\tif (items.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tconst expiresAt = Date.now() + options.ttlMs;\n\t\tconst keys: ItemCacheKey[] = new Array(items.length);\n\t\tconst values: string[] = new Array(items.length);\n\t\tfor (let i = 0; i < items.length; i++) {\n\t\t\tkeys[i] = items[i][0];\n\t\t\tvalues[i] = options.serialize(items[i][1]);\n\t\t}\n\t\tconst result = await this.scripts.saveWithDiffScript(keys, [...values, expiresAt.toString()]);\n\t\tif (!Array.isArray(result)) {\n\t\t\tthrow new Error(`Unexpected non-array result from Redis script: ${typeof result}`);\n\t\t}\n\t\treturn result.map((value) => {\n\t\t\tif (typeof value === 'string') {\n\t\t\t\treturn options.parse(value);\n\t\t\t}\n\t\t\treturn null;\n\t\t});\n\t}\n\n\tasync deleteItems(keys: ItemCacheKey[]): Promise<void> {\n\t\tif (keys.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tawait doBatched(keys, this.maxCommandKeysLimit, async (batch) => {\n\t\t\tawait this.redis.unlink(batch);\n\t\t});\n\t}\n\n\tasync deleteItemsWithDiff<Item>(\n\t\tkeys: ItemCacheKey[],\n\t\toptions: CacheClientArgs<Item>,\n\t): Promise<Array<Item | null>> {\n\t\tif (keys.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tconst result = await this.scripts.deleteWithDiffScript(keys, []);\n\t\tif (!Array.isArray(result)) {\n\t\t\tthrow new Error(`Unexpected non-array result from Redis script: ${typeof result}`);\n\t\t}\n\t\treturn result.map((value) => {\n\t\t\tif (typeof value === 'string') {\n\t\t\t\treturn options.parse(value);\n\t\t\t}\n\t\t\treturn null;\n\t\t});\n\t}\n\n\tasync getQuery<QueryMetadata>(\n\t\tkey: QueryCacheKey,\n\t\toptions: CacheClientArgs<QueryMetadata>,\n\t): Promise<QueryMetadata | null> {\n\t\tconst meta = await this.redis.get(key);\n\t\treturn meta == null ? null : options.parse(meta);\n\t}\n\n\tasync saveQuery<QueryMetadata>(\n\t\tkey: QueryCacheKey,\n\t\tindexes: QueryCacheIndexKey[],\n\t\tmetadata: QueryMetadata,\n\t\toptions: CacheClientArgs<QueryMetadata>,\n\t): Promise<void> {\n\t\tconst now = Date.now();\n\t\tconst expiresAt = now + options.ttlMs;\n\t\tconst pipeline = this.redis.pipeline();\n\t\tpipeline.set(key, options.serialize(metadata), 'PXAT', expiresAt);\n\t\tfor (const indexKey of indexes) {\n\t\t\tpipeline.zadd(indexKey, expiresAt, key);\n\t\t\tpipeline.zremrangebyscore(indexKey, '-inf', now - INDEX_BUFFER_MS);\n\t\t\tpipeline.pexpireat(indexKey, expiresAt + INDEX_BUFFER_MS);\n\t\t}\n\t\tconst result = await pipeline.exec();\n\t\tassertNoPipelineErrors(result);\n\t}\n\n\tasync deleteQueries(indexes: QueryCacheIndexKey[]): Promise<void> {\n\t\tif (indexes.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst result = await this.scripts.deleteQueriesScript(indexes, []);\n\t\tif (typeof result !== 'number') {\n\t\t\tthrow new Error(`Unexpected non-number result from Redis script: ${typeof result}`);\n\t\t}\n\t}\n}\n"],"mappings":";;;;AAmBA,MAAM,kBAAkB;AACxB,MAAM,0BAA0B,KAAK,OAAO;AAC5C,MAAM,6BAA6B;AACnC,MAAM,yBAAyB;AAoB/B,IAAa,mBAAb,cAAsC,YAAY;CACjD;CACA;CACA;CACA;CACA;CAEA,YAAY,OAA6B,SAAmC;AAC3E,QAAM;GACL,WAAW,SAAS;GACpB,UAAU,SAAS;GACnB,OAAO,SAAS;GAChB,CAAC;AACF,OAAK,QAAQ;AACb,OAAK,uBAAuB,SAAS,wBAAwB;AAC7D,OAAK,0BAA0B,SAAS,2BAA2B;AACnE,OAAK,sBAAsB,SAAS,uBAAuB;EAC3D,MAAM,aAAa,OAAO,WAAmB;AAC5C,UAAO,MAAM,KAAK,MAAM,OAAO,QAAQ,OAAO;;EAE/C,MAAM,UAAU,OAAO,KAAa,MAAgB,SAAmB;AACtE,UAAO,MAAM,KAAK,MAAM,QAAQ,KAAK,KAAK,QAAQ,GAAG,MAAM,GAAG,KAAK;;AAEpE,OAAK,UAAU,mBAAmB,YAAY,QAAQ;;CAGvD,MAAM,gBACL,MACA,SAC8B;AAC9B,MAAI,KAAK,WAAW,EACnB,QAAO,EAAE;EAEV,MAAM,SAA6B,EAAE;AACrC,QAAM,UAAU,MAAM,KAAK,qBAAqB,OAAO,UAAU;GAChE,MAAM,cAAc,MAAM,KAAK,MAAM,KAAK,MAAM;AAChD,QAAK,MAAM,SAAS,YACnB,QAAO,KAAK,SAAS,OAAO,OAAO,QAAQ,MAAM,MAAM,CAAC;IAExD;AACF,SAAO;;CAGR,MAAM,UACL,OACA,SACA,cAAsC,EAAE,EACxB;AAChB,MAAI,MAAM,WAAW,EACpB;EAED,MAAM,YAAY,KAAK,KAAK,GAAG,QAAQ;AAKvC,QAAM,cAAc;GACnB,oB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\tCacheClient,\n\ttype CacheClientSaveOptions,\n\ttype ItemCacheKey,\n\ttype QueryCacheIndexKey,\n\ttype QueryCacheKey,\n\ttype CacheClientArgs,\n\ttype CacheClientOptions,\n} from '@baeta/cache';\nimport {\n\tassertNoPipelineErrors,\n\tbatchPipeline,\n\tcreateRedisScripts,\n\ttype RedisScripts,\n} from '@baeta/cache-redis-common';\nimport { doBatched } from '@baeta/cache/sdk';\nimport type Redis from 'ioredis';\nimport type { Cluster as RedisCluster } from 'ioredis';\n\nconst INDEX_BUFFER_MS = 1_000;\nconst MAX_PIPELINE_SIZE_LIMIT = 50 * 1024 * 1024; // 50MB\nconst MAX_PIPELINE_COMMAND_LIMIT = 100_000;\nconst MAX_COMMAND_KEYS_LIMIT = 100_000;\n\nexport interface RedisCacheClientOptions extends CacheClientOptions {\n\t/**\n\t * Maximum total size of commands in a single pipeline batch. If the batch exceeds this size, it will be executed immediately.\n\t * @defaultValue 50 * 1024 * 1024 (50MB)\n\t */\n\tmaxPipelineSizeLimit?: number;\n\t/**\n\t * Maximum number of commands in a single pipeline batch. If the batch exceeds this number, it will be executed immediately.\n\t * @defaultValue 100_000\n\t */\n\tmaxPipelineCommandLimit?: number;\n\t/**\n\t * Maximum number of keys in a single command. If the number of keys exceeds this limit, multiple commands will be executed.\n\t * @defaultValue 100_000\n\t */\n\tmaxCommandKeysLimit?: number;\n}\n\nexport class RedisCacheClient extends CacheClient {\n\tredis: Redis | RedisCluster;\n\tprotected maxPipelineSizeLimit: number;\n\tprotected maxPipelineCommandLimit: number;\n\tprotected maxCommandKeysLimit: number;\n\tprotected scripts: RedisScripts;\n\n\tconstructor(redis: Redis | RedisCluster, options?: RedisCacheClientOptions) {\n\t\tsuper({\n\t\t\tnamespace: options?.namespace,\n\t\t\trevision: options?.revision,\n\t\t\tttlMs: options?.ttlMs,\n\t\t});\n\t\tthis.redis = redis;\n\t\tthis.maxPipelineSizeLimit = options?.maxPipelineSizeLimit ?? MAX_PIPELINE_SIZE_LIMIT;\n\t\tthis.maxPipelineCommandLimit = options?.maxPipelineCommandLimit ?? MAX_PIPELINE_COMMAND_LIMIT;\n\t\tthis.maxCommandKeysLimit = options?.maxCommandKeysLimit ?? MAX_COMMAND_KEYS_LIMIT;\n\t\tconst loadScript = async (script: string) => {\n\t\t\treturn await this.redis.script('LOAD', script);\n\t\t};\n\t\tconst evalSha = async (sha: string, keys: string[], args: string[]) => {\n\t\t\treturn await this.redis.evalsha(sha, keys.length, ...keys, ...args);\n\t\t};\n\t\tthis.scripts = createRedisScripts(loadScript, evalSha);\n\t}\n\n\tasync getPartialItems<Item>(\n\t\tkeys: ItemCacheKey[],\n\t\toptions: CacheClientArgs<Item>,\n\t): Promise<Array<Item | null>> {\n\t\tif (keys.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tconst values: Array<Item | null> = [];\n\t\tawait doBatched(keys, this.maxCommandKeysLimit, async (batch) => {\n\t\t\tconst batchValues = await this.redis.mget(batch);\n\t\t\tfor (const value of batchValues) {\n\t\t\t\tvalues.push(value == null ? null : options.parse(value));\n\t\t\t}\n\t\t});\n\t\treturn values;\n\t}\n\n\tasync saveItems<Item>(\n\t\titems: Array<[ItemCacheKey, Item]>,\n\t\toptions: CacheClientArgs<Item>,\n\t\tsaveOptions: CacheClientSaveOptions = {},\n\t): Promise<void> {\n\t\tif (items.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst expiresAt = Date.now() + options.ttlMs;\n\t\tconst serialized = items.map(([key, value]) => ({\n\t\t\tkey,\n\t\t\tvalue: options.serialize(value),\n\t\t}));\n\t\tawait batchPipeline({\n\t\t\tmakePipeline: () => this.redis.pipeline(),\n\t\t\taddCommand: (pipeline, item) => {\n\t\t\t\tif (saveOptions.disableOverwrite !== true) {\n\t\t\t\t\tpipeline.set(item.key, item.value, 'PXAT', expiresAt);\n\t\t\t\t} else {\n\t\t\t\t\tpipeline.set(item.key, item.value, 'PXAT', expiresAt, 'NX');\n\t\t\t\t}\n\t\t\t},\n\t\t\texecutePipeline: async (pipeline) => {\n\t\t\t\tconst result = await pipeline.exec();\n\t\t\t\tassertNoPipelineErrors(result);\n\t\t\t\treturn [];\n\t\t\t},\n\t\t\testimateSize: (item) => {\n\t\t\t\treturn item.key.length + item.value.length;\n\t\t\t},\n\t\t\titems: serialized,\n\t\t\tmaxBatchBytes: this.maxPipelineSizeLimit,\n\t\t\tmaxBatchCount: this.maxPipelineCommandLimit,\n\t\t});\n\t}\n\n\tasync saveItemsWithDiff<Item>(\n\t\titems: Array<[ItemCacheKey, Item]>,\n\t\toptions: CacheClientArgs<Item>,\n\t): Promise<Array<Item | null>> {\n\t\tif (items.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tconst expiresAt = Date.now() + options.ttlMs;\n\t\tconst tx = this.redis.multi();\n\t\tfor (const item of items) {\n\t\t\ttx.get(item[0]);\n\t\t\ttx.set(item[0], options.serialize(item[1]), 'PXAT', expiresAt);\n\t\t}\n\t\tconst result = await tx.exec();\n\t\tassertNoPipelineErrors(result);\n\t\tconst results: Array<Item | null> = [];\n\t\tfor (let i = 0; i < result.length; i += 2) {\n\t\t\tconst value = result[i][1];\n\t\t\tresults.push(value == null ? null : options.parse(value as string));\n\t\t}\n\t\treturn results;\n\t}\n\n\tasync deleteItems(keys: ItemCacheKey[]): Promise<void> {\n\t\tif (keys.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tawait doBatched(keys, this.maxCommandKeysLimit, async (batch) => {\n\t\t\tawait this.redis.unlink(batch);\n\t\t});\n\t}\n\n\tasync deleteItemsWithDiff<Item>(\n\t\tkeys: ItemCacheKey[],\n\t\toptions: CacheClientArgs<Item>,\n\t): Promise<Array<Item | null>> {\n\t\tif (keys.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tconst tx = this.redis.multi();\n\t\tfor (const key of keys) {\n\t\t\ttx.get(key);\n\t\t\ttx.unlink(key);\n\t\t}\n\t\tconst result = await tx.exec();\n\t\tassertNoPipelineErrors(result);\n\t\tconst results: Array<Item | null> = [];\n\t\tfor (let i = 0; i < result.length; i += 2) {\n\t\t\tconst value = result[i][1];\n\t\t\tresults.push(value == null ? null : options.parse(value as string));\n\t\t}\n\t\treturn results;\n\t}\n\n\tasync getQuery<QueryMetadata>(\n\t\tkey: QueryCacheKey,\n\t\toptions: CacheClientArgs<QueryMetadata>,\n\t): Promise<QueryMetadata | null> {\n\t\tconst meta = await this.redis.get(key);\n\t\treturn meta == null ? null : options.parse(meta);\n\t}\n\n\tasync saveQuery<QueryMetadata>(\n\t\tkey: QueryCacheKey,\n\t\tindexes: QueryCacheIndexKey[],\n\t\tmetadata: QueryMetadata,\n\t\toptions: CacheClientArgs<QueryMetadata>,\n\t): Promise<void> {\n\t\tconst now = Date.now();\n\t\tconst expiresAt = now + options.ttlMs;\n\t\tconst tx = this.redis.multi();\n\t\ttx.set(key, options.serialize(metadata), 'PXAT', expiresAt);\n\t\tfor (const indexKey of indexes) {\n\t\t\ttx.zadd(indexKey, expiresAt, key);\n\t\t\ttx.zremrangebyscore(indexKey, '-inf', now - INDEX_BUFFER_MS);\n\t\t\ttx.pexpireat(indexKey, expiresAt + INDEX_BUFFER_MS);\n\t\t}\n\t\tconst result = await tx.exec();\n\t\tassertNoPipelineErrors(result);\n\t}\n\n\tasync deleteQueries(indexes: QueryCacheIndexKey[]): Promise<void> {\n\t\tif (indexes.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst result = await this.scripts.deleteQueriesScript(indexes, []);\n\t\tif (typeof result !== 'number') {\n\t\t\tthrow new Error(`Unexpected non-number result from Redis script: ${typeof result}`);\n\t\t}\n\t}\n}\n"],"mappings":";;;;AAmBA,MAAM,kBAAkB;AACxB,MAAM,0BAA0B,KAAK,OAAO;AAC5C,MAAM,6BAA6B;AACnC,MAAM,yBAAyB;AAoB/B,IAAa,mBAAb,cAAsC,YAAY;CACjD;CACA;CACA;CACA;CACA;CAEA,YAAY,OAA6B,SAAmC;EAC3E,MAAM;GACL,WAAW,SAAS;GACpB,UAAU,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AAE,CAAC;GACxB,QAAQ,KAAK,SAAS,OAAO,OAAO,QAAQ,MAAM,KAAe,CAAC;EACnE;EACA,OAAO;CACR;CAEA,MAAM,SACL,KACA,SACgC;EAChC,MAAM,OAAO,MAAM,KAAK,MAAM,IAAI,GAAG;EACrC,OAAO,QAAQ,OAAO,OAAO,QAAQ,MAAM,IAAI;CAChD;CAEA,MAAM,UACL,KACA,SACA,UACA,SACgB;EAChB,MAAM,MAAM,KAAK,IAAI;EACrB,MAAM,YAAY,MAAM,QAAQ;EAChC,MAAM,KAAK,KAAK,MAAM,MAAM;EAC5B,GAAG,IAAI,KAAK,QAAQ,UAAU,QAAQ,GAAG,QAAQ,SAAS;EAC1D,KAAK,MAAM,YAAY,SAAS;GAC/B,GAAG,KAAK,UAAU,WAAW,GAAG;GAChC,GAAG,iBAAiB,UAAU,QAAQ,MAAM,eAAe;GAC3D,GAAG,UAAU,UAAU,YAAY,eAAe;EACnD;EAEA,uBAAuB,MADF,GAAG,KAAK,CACA;CAC9B;CAEA,MAAM,cAAc,SAA8C;EACjE,IAAI,QAAQ,WAAW,GACtB;EAED,MAAM,SAAS,MAAM,KAAK,QAAQ,oBAAoB,SAAS,CAAC,CAAC;EACjE,IAAI,OAAO,WAAW,UACrB,MAAM,IAAI,MAAM,mDAAmD,OAAO,QAAQ;CAEpF;AACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baeta/cache-ioredis",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.16",
|
|
4
|
+
"description": "ioredis cache adapter for Baeta.",
|
|
4
5
|
"keywords": [
|
|
5
6
|
"baeta",
|
|
6
7
|
"builder",
|
|
@@ -21,14 +22,14 @@
|
|
|
21
22
|
},
|
|
22
23
|
"repository": {
|
|
23
24
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/andreisergiu98/baeta.git",
|
|
25
|
+
"url": "git+https://github.com/andreisergiu98/baeta.git",
|
|
25
26
|
"directory": "packages/cache-ioredis"
|
|
26
27
|
},
|
|
27
28
|
"files": [
|
|
28
|
-
"dist"
|
|
29
|
-
"package.json"
|
|
29
|
+
"dist"
|
|
30
30
|
],
|
|
31
31
|
"type": "module",
|
|
32
|
+
"sideEffects": false,
|
|
32
33
|
"types": "dist/index.d.ts",
|
|
33
34
|
"exports": {
|
|
34
35
|
".": {
|
|
@@ -37,36 +38,36 @@
|
|
|
37
38
|
}
|
|
38
39
|
},
|
|
39
40
|
"publishConfig": {
|
|
40
|
-
"access": "public",
|
|
41
41
|
"exports": {
|
|
42
42
|
".": {
|
|
43
43
|
"types": "./dist/index.d.ts",
|
|
44
44
|
"default": "./dist/index.js"
|
|
45
45
|
}
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"access": "public"
|
|
47
48
|
},
|
|
48
49
|
"scripts": {
|
|
49
50
|
"build": "builder build",
|
|
50
51
|
"check:deps": "builder check-deps",
|
|
51
52
|
"postpack": "builder prepare --restore",
|
|
52
53
|
"prepack": "builder prepare",
|
|
53
|
-
"test": "builder test
|
|
54
|
+
"test": "builder test",
|
|
54
55
|
"types": "tsc --noEmit"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
57
|
-
"@baeta/cache-redis-common": "^2.0.0-next.
|
|
58
|
+
"@baeta/cache-redis-common": "^2.0.0-next.14"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@baeta/builder": "^0.0.0",
|
|
61
|
-
"@baeta/cache": "^2.0.0-next.
|
|
62
|
+
"@baeta/cache": "^2.0.0-next.16",
|
|
62
63
|
"@baeta/testing": "^0.0.0",
|
|
63
64
|
"@baeta/tests-cache-clients": "^0.0.0",
|
|
64
65
|
"@baeta/tsconfig": "^0.0.0",
|
|
65
|
-
"ioredis": "^5.
|
|
66
|
+
"ioredis": "^5.11.1",
|
|
66
67
|
"typescript": "^6.0.0"
|
|
67
68
|
},
|
|
68
69
|
"peerDependencies": {
|
|
69
|
-
"@baeta/cache": "^2.0.0-next.
|
|
70
|
+
"@baeta/cache": "^2.0.0-next.16",
|
|
70
71
|
"ioredis": "^5.10.0"
|
|
71
72
|
},
|
|
72
73
|
"ava": {
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
]
|
|
76
77
|
},
|
|
77
78
|
"engines": {
|
|
78
|
-
"node": "
|
|
79
|
+
"node": "^22.20.0 || ^24.0.0 || >=26.0.0"
|
|
79
80
|
},
|
|
80
81
|
"typedocOptions": {
|
|
81
82
|
"entryPoints": [
|