@azteam/redis-async 1.0.37 → 1.0.38
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 +1 -1
- package/src/RedisAsync.js +4 -4
package/package.json
CHANGED
package/src/RedisAsync.js
CHANGED
|
@@ -87,21 +87,21 @@ class RedisAsync {
|
|
|
87
87
|
return await ttlAsync(prefixKey);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
async expire(key, time =
|
|
90
|
+
async expire(key, time = 86400) {
|
|
91
91
|
const prefixKey = this.parsePrefix(key);
|
|
92
92
|
|
|
93
93
|
this.client.expire(prefixKey, time);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
async set(key, data,
|
|
96
|
+
async set(key, data, timeSecond = 86400) {
|
|
97
97
|
const prefixKey = this.parsePrefix(key);
|
|
98
98
|
|
|
99
99
|
if (this.connected) {
|
|
100
100
|
console.log(`Redis SET ${prefixKey}`);
|
|
101
|
-
return await this.client.set(prefixKey, JSON.stringify(data), 'EX',
|
|
101
|
+
return await this.client.set(prefixKey, JSON.stringify(data), 'EX', timeSecond);
|
|
102
102
|
} else {
|
|
103
103
|
this.connect();
|
|
104
|
-
return this.set(key, data,
|
|
104
|
+
return this.set(key, data, timeSecond);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|