@autofleet/matmon 2.3.1-beta-1 → 2.3.1-beta-4
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/lib/redis/index.js +4 -1
- package/package.json +1 -1
package/lib/redis/index.js
CHANGED
|
@@ -101,8 +101,11 @@ class RedisCache {
|
|
|
101
101
|
logger_1.default.error('keyValues must be an object', { error });
|
|
102
102
|
throw error;
|
|
103
103
|
}
|
|
104
|
+
if (keyValues === null || keyValues === undefined || Object.keys(keyValues).length === 0) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
104
107
|
const keyValuesWithPrefix = Object.entries(keyValues).map(([key, value]) => [KEY_PREFIX + key, JSON.stringify(value)]);
|
|
105
|
-
const ttl =
|
|
108
|
+
const ttl = Math.trunc(this.baseTTL * (Math.random() + 1));
|
|
106
109
|
try {
|
|
107
110
|
const multi = this.client.multi();
|
|
108
111
|
const setPromise = multi.msetAsync(...keyValuesWithPrefix.flat());
|