fix: Set cache overflow of the setTimeout Maximum delay value (#1742)
This commit is contained in:
parent
d31cb904db
commit
0c633ff67d
|
|
@ -58,7 +58,12 @@ export class Memory<T = any, V = any> {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
const now = new Date().getTime();
|
const now = new Date().getTime();
|
||||||
item.time = now + expires;
|
/**
|
||||||
|
* Prevent overflow of the setTimeout Maximum delay value
|
||||||
|
* Maximum delay value 2,147,483,647 ms
|
||||||
|
* https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value
|
||||||
|
*/
|
||||||
|
item.time = expires > now ? expires : now + expires;
|
||||||
item.timeoutId = setTimeout(
|
item.timeoutId = setTimeout(
|
||||||
() => {
|
() => {
|
||||||
this.remove(key);
|
this.remove(key);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue