@nxtedition/lib 28.0.17 → 28.0.18
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/cache.js +10 -8
- package/package.json +2 -2
package/cache.js
CHANGED
|
@@ -284,18 +284,20 @@ export class AsyncCache {
|
|
|
284
284
|
throw new TypeError('key must be a non-empty string')
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
if (!Number.isFinite(ttl)) {
|
|
291
|
-
throw new TypeError('ttl must be a finite number')
|
|
287
|
+
const ttlValue = Math.min(365000000e3, this.#ttl(value, key) ?? 0)
|
|
288
|
+
if (!Number.isFinite(ttlValue) || ttlValue < 0) {
|
|
289
|
+
throw new TypeError('ttl must be nully or a positive integer')
|
|
292
290
|
}
|
|
293
291
|
|
|
294
|
-
const
|
|
295
|
-
if (!Number.isFinite(
|
|
296
|
-
throw new TypeError('stale must be a
|
|
292
|
+
const staleValue = Math.min(365000000e3, this.#stale(value, key) ?? 0)
|
|
293
|
+
if (!Number.isFinite(staleValue) || staleValue < 0) {
|
|
294
|
+
throw new TypeError('stale must be nully or a positive integer')
|
|
297
295
|
}
|
|
298
296
|
|
|
297
|
+
const now = fastNow()
|
|
298
|
+
const ttl = now + ttlValue
|
|
299
|
+
const stale = ttl + staleValue
|
|
300
|
+
|
|
299
301
|
if (stale <= now) {
|
|
300
302
|
return
|
|
301
303
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "28.0.
|
|
3
|
+
"version": "28.0.18",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"type": "module",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"pino": ">=7.0.0",
|
|
93
93
|
"rxjs": "^7.0.0"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "0e9eba55a86700d53a902b3478366d6cb9791634"
|
|
96
96
|
}
|