@quark-fw/cache 0.1.26 → 0.1.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quark-fw/cache",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "type": "module",
@@ -23,11 +23,11 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@quark-fw/plugin": "0.1.26"
26
+ "@quark-fw/plugin": "0.1.28"
27
27
  },
28
28
  "peerDependencies": {
29
- "@quark-fw/core": "0.1.26",
30
- "@quark-fw/plugin-redis": "0.1.26",
29
+ "@quark-fw/core": "0.1.28",
30
+ "@quark-fw/plugin-redis": "0.1.28",
31
31
  "ioredis": "^5.9.3"
32
32
  },
33
33
  "devDependencies": {
package/src/QuarkCache.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import type { Redis } from "ioredis";
2
+ import { log as rootLog } from "@quark-fw/core/src/log.js";
3
+
4
+ const log = rootLog.child({ scope: "cache" });
2
5
 
3
6
  /**
4
7
  * Значение, прошедшее через JSON: Date становится строкой, undefined
@@ -32,7 +35,7 @@ export type QuarkCacheConfig = {
32
35
  defaultTtl?: number;
33
36
  /** выключатель: при true всегда идёт к источнику (dev, тесты) */
34
37
  disabled?: boolean;
35
- /** куда писать о сбоях Redis (по умолчанию console.error) */
38
+ /** куда писать о сбоях Redis (по умолчанию log.error) */
36
39
  onError?: (error: unknown) => void;
37
40
  };
38
41
 
@@ -65,7 +68,7 @@ export class QuarkCache {
65
68
  prefix = "quark:cache:",
66
69
  defaultTtl = 600,
67
70
  disabled = false,
68
- onError = (error) => console.error("[cache]", error),
71
+ onError = (error) => log.error("redis failure", { err: error }),
69
72
  }: QuarkCacheConfig) {
70
73
  this.client = client as () => RedisLike;
71
74
  this.prefix = prefix;