@azteam/redis-async 1.0.57 → 1.0.60
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 +2 -2
- package/src/RedisAsync.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azteam/redis-async",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.60",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"author": "toda <sp.azsolution.net@gmail.com>",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@azteam/util": "1.0.
|
|
19
|
+
"@azteam/util": "1.0.11",
|
|
20
20
|
"redis": "4.0.6"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/src/RedisAsync.js
CHANGED
|
@@ -52,7 +52,7 @@ class RedisAsync {
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
this.client.on('error', (err) => {
|
|
55
|
-
this._alert('error',
|
|
55
|
+
this._alert('error', `Redis Error${err}`);
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -76,8 +76,7 @@ class RedisAsync {
|
|
|
76
76
|
|
|
77
77
|
async ttl(key) {
|
|
78
78
|
const prefixKey = this.parsePrefix(key);
|
|
79
|
-
|
|
80
|
-
return await this.client.ttl(prefixKey);
|
|
79
|
+
return this.client.ttl(prefixKey);
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
async expire(key, timeSecond = 86400) {
|
|
@@ -117,13 +116,13 @@ class RedisAsync {
|
|
|
117
116
|
|
|
118
117
|
await this.client.del(prefixKey);
|
|
119
118
|
} else {
|
|
120
|
-
const regexKey =
|
|
119
|
+
const regexKey = `*${prefixKey}*`;
|
|
121
120
|
|
|
122
121
|
const keys = await this.client.keys(regexKey);
|
|
123
122
|
|
|
124
123
|
if (keys.length > 0) {
|
|
125
124
|
console.log(`Redis REMOVE keys`, keys);
|
|
126
|
-
return
|
|
125
|
+
return this.client.del(keys);
|
|
127
126
|
}
|
|
128
127
|
}
|
|
129
128
|
} else {
|
|
@@ -133,6 +132,7 @@ class RedisAsync {
|
|
|
133
132
|
}
|
|
134
133
|
return false;
|
|
135
134
|
}
|
|
135
|
+
return false;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
setAlertCallback(callback) {
|