descript-redis-cache 4.1.0 → 4.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/build/index.d.ts +12 -12
- package/build/index.js +12 -12
- package/package.json +9 -9
package/build/index.d.ts
CHANGED
@@ -22,65 +22,65 @@ interface Timers {
|
|
22
22
|
end: number;
|
23
23
|
}
|
24
24
|
export type LoggerEvent = ({
|
25
|
-
type: EVENT.REDIS_CACHE_INITIALIZED;
|
25
|
+
'type': EVENT.REDIS_CACHE_INITIALIZED;
|
26
26
|
options: Options;
|
27
27
|
} | {
|
28
|
-
type: EVENT.REDIS_CACHE_READ_START;
|
28
|
+
'type': EVENT.REDIS_CACHE_READ_START;
|
29
29
|
key: string;
|
30
30
|
normalizedKey: string;
|
31
31
|
} | {
|
32
|
-
type: EVENT.REDIS_CACHE_READ_KEY_NOT_FOUND;
|
32
|
+
'type': EVENT.REDIS_CACHE_READ_KEY_NOT_FOUND;
|
33
33
|
key: string;
|
34
34
|
normalizedKey: string;
|
35
35
|
timers: Timers;
|
36
36
|
} | {
|
37
|
-
type: EVENT.REDIS_CACHE_READ_TIMEOUT;
|
37
|
+
'type': EVENT.REDIS_CACHE_READ_TIMEOUT;
|
38
38
|
key: string;
|
39
39
|
normalizedKey: string;
|
40
40
|
timers: Timers;
|
41
41
|
} | {
|
42
|
-
type: EVENT.REDIS_CACHE_READ_ERROR;
|
42
|
+
'type': EVENT.REDIS_CACHE_READ_ERROR;
|
43
43
|
error: Error;
|
44
44
|
key: string;
|
45
45
|
normalizedKey: string;
|
46
46
|
timers: Timers;
|
47
47
|
} | {
|
48
|
-
type: EVENT.REDIS_CACHE_JSON_PARSING_FAILED;
|
48
|
+
'type': EVENT.REDIS_CACHE_JSON_PARSING_FAILED;
|
49
49
|
data: unknown;
|
50
50
|
error: unknown;
|
51
51
|
key: string;
|
52
52
|
normalizedKey: string;
|
53
53
|
timers: Timers;
|
54
54
|
} | {
|
55
|
-
type: EVENT.REDIS_CACHE_READ_DONE;
|
55
|
+
'type': EVENT.REDIS_CACHE_READ_DONE;
|
56
56
|
data: unknown;
|
57
57
|
key: string;
|
58
58
|
normalizedKey: string;
|
59
59
|
timers: Timers;
|
60
60
|
} | {
|
61
|
-
type: EVENT.REDIS_CACHE_WRITE_START;
|
61
|
+
'type': EVENT.REDIS_CACHE_WRITE_START;
|
62
62
|
key: string;
|
63
63
|
normalizedKey: string;
|
64
64
|
} | {
|
65
|
-
type: EVENT.REDIS_CACHE_JSON_STRINGIFY_FAILED;
|
65
|
+
'type': EVENT.REDIS_CACHE_JSON_STRINGIFY_FAILED;
|
66
66
|
data: unknown;
|
67
67
|
error: unknown;
|
68
68
|
key: string;
|
69
69
|
normalizedKey: string;
|
70
70
|
timers: Timers;
|
71
71
|
} | {
|
72
|
-
type: EVENT.REDIS_CACHE_WRITE_ERROR;
|
72
|
+
'type': EVENT.REDIS_CACHE_WRITE_ERROR;
|
73
73
|
error: Error;
|
74
74
|
key: string;
|
75
75
|
normalizedKey: string;
|
76
76
|
timers: Timers;
|
77
77
|
} | {
|
78
|
-
type: EVENT.REDIS_CACHE_WRITE_FAILED;
|
78
|
+
'type': EVENT.REDIS_CACHE_WRITE_FAILED;
|
79
79
|
key: string;
|
80
80
|
normalizedKey: string;
|
81
81
|
timers: Timers;
|
82
82
|
} | {
|
83
|
-
type: EVENT.REDIS_CACHE_WRITE_DONE;
|
83
|
+
'type': EVENT.REDIS_CACHE_WRITE_DONE;
|
84
84
|
data: string;
|
85
85
|
key: string;
|
86
86
|
normalizedKey: string;
|
package/build/index.js
CHANGED
@@ -54,7 +54,7 @@ class Cache {
|
|
54
54
|
}
|
55
55
|
}
|
56
56
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
57
|
-
type: EVENT.REDIS_CACHE_INITIALIZED,
|
57
|
+
'type': EVENT.REDIS_CACHE_INITIALIZED,
|
58
58
|
options: { ...__classPrivateFieldGet(this, _Cache_options, "f") },
|
59
59
|
});
|
60
60
|
}
|
@@ -68,7 +68,7 @@ class Cache {
|
|
68
68
|
const normalizedKey = __classPrivateFieldGet(this, _Cache_instances, "m", _Cache_normalizeKey).call(this, key);
|
69
69
|
return new Promise((resolve, reject) => {
|
70
70
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
71
|
-
type: EVENT.REDIS_CACHE_READ_START,
|
71
|
+
'type': EVENT.REDIS_CACHE_READ_START,
|
72
72
|
key,
|
73
73
|
normalizedKey,
|
74
74
|
});
|
@@ -77,7 +77,7 @@ class Cache {
|
|
77
77
|
const timer = setTimeout(() => {
|
78
78
|
isTimeout = true;
|
79
79
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
80
|
-
type: EVENT.REDIS_CACHE_READ_TIMEOUT,
|
80
|
+
'type': EVENT.REDIS_CACHE_READ_TIMEOUT,
|
81
81
|
key,
|
82
82
|
normalizedKey,
|
83
83
|
timers: {
|
@@ -96,7 +96,7 @@ class Cache {
|
|
96
96
|
clearTimeout(timer);
|
97
97
|
if (error) {
|
98
98
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
99
|
-
type: EVENT.REDIS_CACHE_READ_ERROR,
|
99
|
+
'type': EVENT.REDIS_CACHE_READ_ERROR,
|
100
100
|
error,
|
101
101
|
key,
|
102
102
|
normalizedKey,
|
@@ -111,7 +111,7 @@ class Cache {
|
|
111
111
|
}
|
112
112
|
else if (!data) {
|
113
113
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
114
|
-
type: EVENT.REDIS_CACHE_READ_KEY_NOT_FOUND,
|
114
|
+
'type': EVENT.REDIS_CACHE_READ_KEY_NOT_FOUND,
|
115
115
|
key,
|
116
116
|
normalizedKey,
|
117
117
|
timers: {
|
@@ -130,7 +130,7 @@ class Cache {
|
|
130
130
|
}
|
131
131
|
catch (error) {
|
132
132
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
133
|
-
type: EVENT.REDIS_CACHE_JSON_PARSING_FAILED,
|
133
|
+
'type': EVENT.REDIS_CACHE_JSON_PARSING_FAILED,
|
134
134
|
data,
|
135
135
|
error,
|
136
136
|
key,
|
@@ -146,7 +146,7 @@ class Cache {
|
|
146
146
|
return;
|
147
147
|
}
|
148
148
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
149
|
-
type: EVENT.REDIS_CACHE_READ_DONE,
|
149
|
+
'type': EVENT.REDIS_CACHE_READ_DONE,
|
150
150
|
data,
|
151
151
|
key,
|
152
152
|
normalizedKey,
|
@@ -168,7 +168,7 @@ class Cache {
|
|
168
168
|
const normalizedKey = __classPrivateFieldGet(this, _Cache_instances, "m", _Cache_normalizeKey).call(this, key);
|
169
169
|
return new Promise((resolve, reject) => {
|
170
170
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
171
|
-
type: EVENT.REDIS_CACHE_WRITE_START,
|
171
|
+
'type': EVENT.REDIS_CACHE_WRITE_START,
|
172
172
|
key,
|
173
173
|
normalizedKey,
|
174
174
|
});
|
@@ -178,7 +178,7 @@ class Cache {
|
|
178
178
|
}
|
179
179
|
catch (error) {
|
180
180
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
181
|
-
type: EVENT.REDIS_CACHE_JSON_STRINGIFY_FAILED,
|
181
|
+
'type': EVENT.REDIS_CACHE_JSON_STRINGIFY_FAILED,
|
182
182
|
data: value,
|
183
183
|
error,
|
184
184
|
key,
|
@@ -197,7 +197,7 @@ class Cache {
|
|
197
197
|
__classPrivateFieldGet(this, _Cache_writer, "f").set(normalizedKey, json, 'EX', maxage, (error, done) => {
|
198
198
|
if (error) {
|
199
199
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
200
|
-
type: EVENT.REDIS_CACHE_WRITE_ERROR,
|
200
|
+
'type': EVENT.REDIS_CACHE_WRITE_ERROR,
|
201
201
|
error,
|
202
202
|
key,
|
203
203
|
normalizedKey,
|
@@ -212,7 +212,7 @@ class Cache {
|
|
212
212
|
}
|
213
213
|
else if (!done) {
|
214
214
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
215
|
-
type: EVENT.REDIS_CACHE_WRITE_FAILED,
|
215
|
+
'type': EVENT.REDIS_CACHE_WRITE_FAILED,
|
216
216
|
key,
|
217
217
|
normalizedKey,
|
218
218
|
timers: {
|
@@ -226,7 +226,7 @@ class Cache {
|
|
226
226
|
}
|
227
227
|
else {
|
228
228
|
__classPrivateFieldGet(this, _Cache_instances, "m", _Cache_log).call(this, {
|
229
|
-
type: EVENT.REDIS_CACHE_WRITE_DONE,
|
229
|
+
'type': EVENT.REDIS_CACHE_WRITE_DONE,
|
230
230
|
data: json,
|
231
231
|
key,
|
232
232
|
normalizedKey,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "descript-redis-cache",
|
3
|
-
"version": "4.1.
|
3
|
+
"version": "4.1.1",
|
4
4
|
"description": "plugin for descript to use redis as cache",
|
5
5
|
"main": "./build/index.js",
|
6
6
|
"types": "./build/index.d.ts",
|
@@ -31,20 +31,20 @@
|
|
31
31
|
"build"
|
32
32
|
],
|
33
33
|
"dependencies": {
|
34
|
-
"
|
34
|
+
"@stylistic/eslint-plugin": "^5.3.1",
|
35
|
+
"ioredis": "^5.7.0"
|
35
36
|
},
|
36
37
|
"peerDependencies": {
|
37
38
|
"descript": ">=4"
|
38
39
|
},
|
39
40
|
"devDependencies": {
|
40
41
|
"@eslint/js": "^9.14.0",
|
41
|
-
"@stylistic/eslint-plugin-ts": "^2.11.0",
|
42
42
|
"@types/eslint__js": "^8.42.3",
|
43
|
-
"@types/node": "^22.
|
44
|
-
"descript": "^4.0.
|
45
|
-
"eslint": "^9.
|
46
|
-
"typescript": "^5.
|
47
|
-
"typescript-eslint": "^8.
|
48
|
-
"vitest": "^2.
|
43
|
+
"@types/node": "^22.18.1",
|
44
|
+
"descript": "^4.0.16",
|
45
|
+
"eslint": "^9.35.0",
|
46
|
+
"typescript": "^5.9.2",
|
47
|
+
"typescript-eslint": "^8.42.0",
|
48
|
+
"vitest": "^3.2.4"
|
49
49
|
}
|
50
50
|
}
|