@keyv/redis 2.5.6 → 2.5.7
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 +4 -3
- package/src/index.js +9 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keyv/redis",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.7",
|
|
4
4
|
"description": "Redis storage adapter for Keyv",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -66,9 +66,10 @@
|
|
|
66
66
|
"delay": "^5.0.0",
|
|
67
67
|
"keyv": "*",
|
|
68
68
|
"requirable": "^1.0.5",
|
|
69
|
+
"timekeeper": "^2.2.0",
|
|
69
70
|
"ts-node": "^10.9.1",
|
|
70
|
-
"tsd": "^0.
|
|
71
|
-
"typescript": "^
|
|
71
|
+
"tsd": "^0.28.1",
|
|
72
|
+
"typescript": "^5.0.3",
|
|
72
73
|
"xo": "^0.53.1"
|
|
73
74
|
},
|
|
74
75
|
"tsd": {
|
package/src/index.js
CHANGED
|
@@ -51,9 +51,8 @@ class KeyvRedis extends EventEmitter {
|
|
|
51
51
|
|
|
52
52
|
return this.redis.set(key, value);
|
|
53
53
|
})
|
|
54
|
-
.then(() =>
|
|
55
|
-
|
|
56
|
-
});
|
|
54
|
+
.then(() => this.redis.sadd(this._getNamespace(), key))
|
|
55
|
+
.then(() => undefined);
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
delete(key) {
|
|
@@ -77,15 +76,14 @@ class KeyvRedis extends EventEmitter {
|
|
|
77
76
|
const get = this.redis.mget.bind(this.redis);
|
|
78
77
|
async function * iterate(curs, pattern) {
|
|
79
78
|
const [cursor, keys] = await scan(curs, 'MATCH', pattern);
|
|
80
|
-
if (keys.length === 0) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
if (keys.length > 0) {
|
|
81
|
+
const values = await get(keys);
|
|
82
|
+
for (const [i] of keys.entries()) {
|
|
83
|
+
const key = keys[i];
|
|
84
|
+
const value = values[i];
|
|
85
|
+
yield [key, value];
|
|
86
|
+
}
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
if (cursor !== '0') {
|