()
| 71 | } |
| 72 | } |
| 73 | function destroy() { |
| 74 | // delete all keys to make sure onDispose is called for each value |
| 75 | if (onDispose) { |
| 76 | // cache inherits null so we don't need to check hasOwnProperty |
| 77 | // eslint-disable-next-line guard-for-in |
| 78 | for (const key in cache) { |
| 79 | del(key); |
| 80 | } |
| 81 | } else { |
| 82 | cache = Object.create(null); |
| 83 | } |
| 84 | clearTimeout(timer); |
| 85 | timer = 0; |
| 86 | } |
| 87 | function reschedule(entry, lifetime = defaultLifetime) { |
| 88 | entry.expiry = lifetime + getNow(); |
| 89 | if (timer) { |