File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments