befly 3.10.3 → 3.10.4

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.
@@ -289,11 +289,11 @@ const id = await befly.db.insData({
289
289
  import { CacheKeys } from "befly/lib/cacheKeys";
290
290
 
291
291
  // 获取键名
292
- const apisAllKey = CacheKeys.apisAll(); // 'befly:apis:all'
293
- const menusAllKey = CacheKeys.menusAll(); // 'befly:menus:all'
294
- const adminRoleInfoKey = CacheKeys.roleInfo("admin"); // 'befly:role:info:admin'
295
- const adminRoleApisKey = CacheKeys.roleApis("admin"); // 'befly:role:apis:admin'
296
- const userTableColumnsKey = CacheKeys.tableColumns("user"); // 'befly:table:columns:user'
292
+ const apisAllKey = CacheKeys.apisAll(); // 'apis:all'
293
+ const menusAllKey = CacheKeys.menusAll(); // 'menus:all'
294
+ const adminRoleInfoKey = CacheKeys.roleInfo("admin"); // 'role:info:admin'
295
+ const adminRoleApisKey = CacheKeys.roleApis("admin"); // 'role:apis:admin'
296
+ const userTableColumnsKey = CacheKeys.tableColumns("user"); // 'table:columns:user'
297
297
  ```
298
298
 
299
299
  ### 键名前缀
@@ -311,7 +311,7 @@ Redis 插件支持配置全局前缀,避免键名冲突:
311
311
  所有键会自动添加前缀,最终写入 Redis 的 key 形如:`myapp:<key>`。
312
312
 
313
313
  - 例如:你调用 `befly.redis.getString("user:1")`,实际访问的是 `myapp:user:1`
314
- - 例如:你调用 `befly.redis.sismember(CacheKeys.roleApis("admin"), "/api/user")`,实际访问的是 `myapp:befly:role:apis:admin`
314
+ - 例如:你调用 `befly.redis.sismember(CacheKeys.roleApis("admin"), "/api/user")`,实际访问的是 `myapp:role:apis:admin`
315
315
 
316
316
  > 注意:`redis.prefix` **不允许包含** `:`,因为 RedisHelper 会自动拼接分隔符 `:`。
317
317
 
package/lib/cacheKeys.ts CHANGED
@@ -9,30 +9,30 @@
9
9
  export class CacheKeys {
10
10
  /** 所有接口缓存 */
11
11
  static apisAll(): string {
12
- return "befly:apis:all";
12
+ return "apis:all";
13
13
  }
14
14
 
15
15
  /** 所有菜单缓存 */
16
16
  static menusAll(): string {
17
- return "befly:menus:all";
17
+ return "menus:all";
18
18
  }
19
19
 
20
20
  /** 角色信息缓存(完整角色对象) */
21
21
  static roleInfo(roleCode: string): string {
22
- return `befly:role:info:${roleCode}`;
22
+ return `role:info:${roleCode}`;
23
23
  }
24
24
 
25
25
  /**
26
26
  * 角色接口权限缓存(Set 集合)
27
- * - key: befly:role:apis:${roleCode}
27
+ * - key: role:apis:${roleCode}
28
28
  * - member: url.pathname(例如 /api/user/login;与 method 无关)
29
29
  */
30
30
  static roleApis(roleCode: string): string {
31
- return `befly:role:apis:${roleCode}`;
31
+ return `role:apis:${roleCode}`;
32
32
  }
33
33
 
34
34
  /** 表结构缓存 */
35
35
  static tableColumns(table: string): string {
36
- return `befly:table:columns:${table}`;
36
+ return `table:columns:${table}`;
37
37
  }
38
38
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "befly",
3
- "version": "3.10.3",
4
- "gitHead": "7dd54bc1ed484139fa52ce5408f1a6c166e2a928",
3
+ "version": "3.10.4",
4
+ "gitHead": "a281633b6f8be7c941aa7e6a3f677bfc18b65ddc",
5
5
  "private": false,
6
6
  "description": "Befly - 为 Bun 专属打造的 TypeScript API 接口框架核心引擎",
7
7
  "keywords": [