@aomex/cache-redis-adapter 3.30.8-alpha.62.sha-92b25bb → 4.0.0

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 CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.0.0](https://github.com/aomex/aomex/compare/v3.30.7...v4.0.0) (2026-11-17)
7
+
8
+ * chore!: 升级依赖至最新 ([9a679fa](https://github.com/aomex/aomex/commit/9a679faf0a4e2b313e8ce9081c1ecc65356b844c))
9
+ * feat(cache)!: 新增文件缓存,适配器改为子路径导出并移除工厂函数 ([943b243](https://github.com/aomex/aomex/commit/943b2432ebc97db8f4f199ff0ee8fa2c2dc04bfd))
10
+ * feat(cache)!: 引入BaseCacheService服务和remember装饰器 ([f48dba5](https://github.com/aomex/aomex/commit/f48dba555e6ddfaa4cc5b240b30cea6e4b39a0c1))
11
+ * chore!: 升级至 TypeScript 7 并将构建工具迁移到 tsdown ([a111409](https://github.com/aomex/aomex/commit/a111409021e2ee81ee5fb20ccc75480c9b5fa4c0))
12
+
13
+ ### BREAKING CHANGES
14
+
15
+ * mongoose 最低版本为v9
16
+ * Node.js 最低版本提升至 `>=24.0.0`。
17
+ * 最低 TypeScript 版本为 7。
18
+ * 移除 `memoryAdapter` / `redisAdapter`,改为直接new Class
19
+ * 装饰器从 Caching.decorate 改为 remember
20
+
21
+
6
22
  ## [3.30.7](https://github.com/aomex/aomex/compare/v3.30.6...v3.30.7) (2026-11-01)
7
23
 
8
24
  **Note:** Version bump only for package @aomex/cache-redis-adapter
package/dist/index.d.ts CHANGED
@@ -17,4 +17,5 @@ export declare class CacheRedisAdapter extends CacheAdapter {
17
17
  leftPushValue(key: string, ...values: string[]): Promise<boolean>;
18
18
  rightPopValue(key: string): Promise<string | null>;
19
19
  disconnect(): Promise<void>;
20
- }
20
+ }
21
+ export type { RedisOptions };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { CacheAdapter } from '@aomex/cache';\nimport { Redis, type RedisOptions } from 'ioredis';\n\nexport class CacheRedisAdapter extends CacheAdapter {\n public readonly redis: Redis;\n protected version?: string;\n\n constructor(config: RedisOptions) {\n super();\n this.redis = new Redis({ ...config, lazyConnect: true });\n }\n\n getValue(key: string): Promise<string | null> {\n return this.redis.get(key);\n }\n\n async setValue(\n key: string,\n value: string,\n duration?: number | undefined,\n ): Promise<boolean> {\n let result: 'OK';\n if (duration !== undefined) {\n result = await this.redis.set(key, value, 'PX', duration);\n } else {\n result = await this.redis.set(key, value);\n }\n return result === 'OK';\n }\n\n override async setNotExistValue(\n key: string,\n value: string,\n duration?: number | undefined,\n ): Promise<boolean> {\n let result: 'OK' | null;\n if (duration !== undefined) {\n result = await this.redis.set(key, value, 'PX', duration, 'NX');\n } else {\n result = await this.redis.set(key, value, 'NX');\n }\n return result === 'OK';\n }\n\n async existsKey(key: string): Promise<boolean> {\n const count = await this.redis.exists(key);\n return count === 1;\n }\n\n async deleteValue(key: string): Promise<boolean> {\n await this.redis.del(key);\n return true;\n }\n\n async deleteAllValues(): Promise<boolean> {\n const { redis } = this;\n const redisPrefix = redis.options.keyPrefix ?? '';\n\n if (redisPrefix) {\n await redis.eval(\n `\nfor _,k in ipairs(redis.call('keys', ARGV[1])) do \n redis.call('del', k) \nend\n`,\n 0,\n `${redisPrefix}*`,\n );\n } else {\n await redis.flushdb();\n }\n return true;\n }\n\n override increaseValue(key: string): Promise<number> {\n return this.redis.incr(key);\n }\n\n override decreaseValue(key: string): Promise<number> {\n return this.redis.decr(key);\n }\n\n override async expireKey(key: string, duration: number): Promise<boolean> {\n const changeRow = await this.redis.pexpire(key, duration);\n return changeRow === 1;\n }\n\n override async ttlKey(key: string): Promise<number> {\n const result = await this.redis.pttl(key);\n return result;\n }\n\n override async leftPushValue(key: string, ...values: string[]): Promise<boolean> {\n const changeRow = await this.redis.lpush(key, ...values.reverse());\n return changeRow >= 1;\n }\n\n override async rightPopValue(key: string): Promise<string | null> {\n const result = await this.redis.rpop(key);\n return result;\n }\n\n override async disconnect(): Promise<void> {\n const { status } = this.redis;\n if (status === 'end' || status === 'close') return;\n this.redis.disconnect();\n }\n}\n"],"mappings":";;;AAGA,IAAa,oBAAb,cAAuC,aAAa;CAClD;CACA;CAEA,YAAY,QAAsB;EAChC,MAAM;EACN,KAAK,QAAQ,IAAI,MAAM;GAAE,GAAG;GAAQ,aAAa;EAAK,CAAC;CACzD;CAEA,SAAS,KAAqC;EAC5C,OAAO,KAAK,MAAM,IAAI,GAAG;CAC3B;CAEA,MAAM,SACJ,KACA,OACA,UACkB;EAClB,IAAI;EACJ,IAAI,aAAa,KAAA,GACf,SAAS,MAAM,KAAK,MAAM,IAAI,KAAK,OAAO,MAAM,QAAQ;OAExD,SAAS,MAAM,KAAK,MAAM,IAAI,KAAK,KAAK;EAE1C,OAAO,WAAW;CACpB;CAEA,MAAe,iBACb,KACA,OACA,UACkB;EAClB,IAAI;EACJ,IAAI,aAAa,KAAA,GACf,SAAS,MAAM,KAAK,MAAM,IAAI,KAAK,OAAO,MAAM,UAAU,IAAI;OAE9D,SAAS,MAAM,KAAK,MAAM,IAAI,KAAK,OAAO,IAAI;EAEhD,OAAO,WAAW;CACpB;CAEA,MAAM,UAAU,KAA+B;EAE7C,OAAO,MADa,KAAK,MAAM,OAAO,GAAG,MACxB;CACnB;CAEA,MAAM,YAAY,KAA+B;EAC/C,MAAM,KAAK,MAAM,IAAI,GAAG;EACxB,OAAO;CACT;CAEA,MAAM,kBAAoC;EACxC,MAAM,EAAE,UAAU;EAClB,MAAM,cAAc,MAAM,QAAQ,aAAa;EAE/C,IAAI,aACF,MAAM,MAAM,KACV;;;;GAKA,GACA,GAAG,YAAY,EACjB;OAEA,MAAM,MAAM,QAAQ;EAEtB,OAAO;CACT;CAEA,cAAuB,KAA8B;EACnD,OAAO,KAAK,MAAM,KAAK,GAAG;CAC5B;CAEA,cAAuB,KAA8B;EACnD,OAAO,KAAK,MAAM,KAAK,GAAG;CAC5B;CAEA,MAAe,UAAU,KAAa,UAAoC;EAExE,OAAO,MADiB,KAAK,MAAM,QAAQ,KAAK,QAAQ,MACnC;CACvB;CAEA,MAAe,OAAO,KAA8B;EAElD,OAAO,MADc,KAAK,MAAM,KAAK,GAAG;CAE1C;CAEA,MAAe,cAAc,KAAa,GAAG,QAAoC;EAE/E,OAAO,MADiB,KAAK,MAAM,MAAM,KAAK,GAAG,OAAO,QAAQ,CAAC,KAC7C;CACtB;CAEA,MAAe,cAAc,KAAqC;EAEhE,OAAO,MADc,KAAK,MAAM,KAAK,GAAG;CAE1C;CAEA,MAAe,aAA4B;EACzC,MAAM,EAAE,WAAW,KAAK;EACxB,IAAI,WAAW,SAAS,WAAW,SAAS;EAC5C,KAAK,MAAM,WAAW;CACxB;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { CacheAdapter } from '@aomex/cache';\nimport { Redis, type RedisOptions } from 'ioredis';\n\nexport type { RedisOptions };\n\nexport class CacheRedisAdapter extends CacheAdapter {\n public readonly redis: Redis;\n protected version?: string;\n\n constructor(config: RedisOptions) {\n super();\n this.redis = new Redis({ ...config, lazyConnect: true });\n }\n\n getValue(key: string): Promise<string | null> {\n return this.redis.get(key);\n }\n\n async setValue(\n key: string,\n value: string,\n duration?: number | undefined,\n ): Promise<boolean> {\n let result: 'OK';\n if (duration !== undefined) {\n result = await this.redis.set(key, value, 'PX', duration);\n } else {\n result = await this.redis.set(key, value);\n }\n return result === 'OK';\n }\n\n override async setNotExistValue(\n key: string,\n value: string,\n duration?: number | undefined,\n ): Promise<boolean> {\n let result: 'OK' | null;\n if (duration !== undefined) {\n result = await this.redis.set(key, value, 'PX', duration, 'NX');\n } else {\n result = await this.redis.set(key, value, 'NX');\n }\n return result === 'OK';\n }\n\n async existsKey(key: string): Promise<boolean> {\n const count = await this.redis.exists(key);\n return count === 1;\n }\n\n async deleteValue(key: string): Promise<boolean> {\n await this.redis.del(key);\n return true;\n }\n\n async deleteAllValues(): Promise<boolean> {\n const { redis } = this;\n const redisPrefix = redis.options.keyPrefix ?? '';\n\n if (redisPrefix) {\n await redis.eval(\n `\nfor _,k in ipairs(redis.call('keys', ARGV[1])) do \n redis.call('del', k) \nend\n`,\n 0,\n `${redisPrefix}*`,\n );\n } else {\n await redis.flushdb();\n }\n return true;\n }\n\n override increaseValue(key: string): Promise<number> {\n return this.redis.incr(key);\n }\n\n override decreaseValue(key: string): Promise<number> {\n return this.redis.decr(key);\n }\n\n override async expireKey(key: string, duration: number): Promise<boolean> {\n const changeRow = await this.redis.pexpire(key, duration);\n return changeRow === 1;\n }\n\n override async ttlKey(key: string): Promise<number> {\n const result = await this.redis.pttl(key);\n return result;\n }\n\n override async leftPushValue(key: string, ...values: string[]): Promise<boolean> {\n const changeRow = await this.redis.lpush(key, ...values.reverse());\n return changeRow >= 1;\n }\n\n override async rightPopValue(key: string): Promise<string | null> {\n const result = await this.redis.rpop(key);\n return result;\n }\n\n override async disconnect(): Promise<void> {\n const { status } = this.redis;\n if (status === 'end' || status === 'close') return;\n this.redis.disconnect();\n }\n}\n"],"mappings":";;;AAKA,IAAa,oBAAb,cAAuC,aAAa;CAClD;CACA;CAEA,YAAY,QAAsB;EAChC,MAAM;EACN,KAAK,QAAQ,IAAI,MAAM;GAAE,GAAG;GAAQ,aAAa;EAAK,CAAC;CACzD;CAEA,SAAS,KAAqC;EAC5C,OAAO,KAAK,MAAM,IAAI,GAAG;CAC3B;CAEA,MAAM,SACJ,KACA,OACA,UACkB;EAClB,IAAI;EACJ,IAAI,aAAa,KAAA,GACf,SAAS,MAAM,KAAK,MAAM,IAAI,KAAK,OAAO,MAAM,QAAQ;OAExD,SAAS,MAAM,KAAK,MAAM,IAAI,KAAK,KAAK;EAE1C,OAAO,WAAW;CACpB;CAEA,MAAe,i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apter",
3
- "version": "3.30.8-alpha.62.sha-92b25bb",
3
+ "version": "4.0.0",
4
4
  "description": "aomex缓存库redis适配器",
5
- "scripts": {
6
- "prepublishOnly": "tsdown"
7
- },
8
5
  "type": "module",
9
- "types": "src/index.ts",
10
- "exports": "./src/index.ts",
11
- "publishConfig": {
12
- "types": "dist/index.d.ts",
13
- "exports": {
14
- ".": {
15
- "types": "./dist/index.d.ts",
16
- "import": "./dist/index.js"
17
- },
18
- "./package.json": "./package.json"
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
19
11
  },
12
+ "./package.json": "./package.json"
13
+ },
14
+ "publishConfig": {
20
15
  "access": "public"
21
16
  },
22
17
  "files": [
@@ -27,16 +22,20 @@
27
22
  "CHANGELOG.md"
28
23
  ],
29
24
  "keywords": [],
30
- "repository": "git@github.com:aomex/aomex.git",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git@github.com:aomex/aomex.git"
28
+ },
31
29
  "homepage": "https://aomex.js.org",
32
30
  "license": "MIT",
33
31
  "peerDependencies": {
34
- "@aomex/cache": "^4.0.0",
35
- "ioredis": ">=5"
32
+ "@aomex/cache": "^4.0.0"
36
33
  },
37
- "devDependencies": {
38
- "@aomex/cache": "3.30.8-alpha.62.sha-92b25bb",
34
+ "dependencies": {
39
35
  "ioredis": "^6.0.0"
40
36
  },
41
- "gitHead": "92b25bbcd6c3ae28160316117a74c88619b5bc8d"
42
- }
37
+ "devDependencies": {
38
+ "@aomex/cache": "4.0.0"
39
+ },
40
+ "scripts": {}
41
+ }