Skip to content

Commit a627659

Browse files
committed
📚 Update docs (#1995)
1 parent aec091e commit a627659

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib/clients/cache.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export class Cache<T> {
4646
* @property {number} oldestEntry - The timestamp of the oldest entry in the cache.
4747
*/
4848
get health(): { size: number; oldestEntry: number } {
49+
if (this.cache.size === 0) {
50+
return { size: 0, oldestEntry: 0 };
51+
}
52+
4953
const oldestEntry = Math.min(
5054
...Array.from(this.cache.values()).map((entry) => entry.timestamp),
5155
);
@@ -97,7 +101,7 @@ export class Cache<T> {
97101
}
98102

99103
/**
100-
* Disposes of resources used by the Aizu Online Judge client.
104+
* Disposes of resources used by the cache instance.
101105
*
102106
* This method clears the interval used for cleanup and clears the cache.
103107
* It should be called when the client is no longer needed to prevent memory leaks.

0 commit comments

Comments
 (0)