@hile/ioredis 1.0.14 → 1.1.1

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/README.md CHANGED
@@ -20,6 +20,8 @@ const redis = await loadService(ioredisService)
20
20
  // 使用 redis.get/set 等 ioredis API
21
21
  ```
22
22
 
23
+ 默认导出使用稳定的服务 key(实现中为 `Symbol.for` + 包名)。需要多个 Redis 连接时请为每个连接使用不同的 `defineService(key, ...)`。
24
+
23
25
  ## 环境变量
24
26
 
25
27
  默认客户端从以下环境变量读取配置:
package/SKILL.md CHANGED
@@ -9,7 +9,7 @@ description: "@hile/ioredis 的代码生成与使用规范。适用于 Redis 服
9
9
 
10
10
  ## 1. 架构概览
11
11
 
12
- `@hile/ioredis` 提供一个默认导出的 Hile 服务:
12
+ `@hile/ioredis` 提供一个默认导出的 Hile 服务(服务 key 为稳定 symbol,见包内实现):
13
13
 
14
14
  - 使用环境变量构建 ioredis 客户端
15
15
  - 首次加载时建立连接并等待 `connect`
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import pkg from '../package.json' with { type: 'json' };
1
2
  import { defineService } from '@hile/core';
2
3
  import Redis from 'ioredis';
3
4
  /**
@@ -10,7 +11,7 @@ import Redis from 'ioredis';
10
11
  * - REDIS_PASSWORD: Redis 密码
11
12
  * - REDIS_DB: Redis 数据库
12
13
  */
13
- export default defineService(async (shutdown) => {
14
+ export default defineService(Symbol.for(pkg.name), async (shutdown) => {
14
15
  const options = {
15
16
  host: process.env.REDIS_HOST,
16
17
  port: typeof process.env.REDIS_PORT === 'string' ? Number(process.env.REDIS_PORT) : process.env.REDIS_PORT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hile/ioredis",
3
- "version": "1.0.14",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -21,8 +21,8 @@
21
21
  "vitest": "^4.0.18"
22
22
  },
23
23
  "dependencies": {
24
- "@hile/core": "^1.0.22",
24
+ "@hile/core": "^1.1.1",
25
25
  "ioredis": "^5.10.0"
26
26
  },
27
- "gitHead": "ffc0bf9ab4d0e251244c174536bac79c1f2f77fe"
27
+ "gitHead": "3b67348b7541f0f14528a8e2c995ada652ed39e5"
28
28
  }