* Get cache statistics
()
| 124 | * Get cache statistics |
| 125 | */ |
| 126 | getStats() { |
| 127 | const entries = Array.from(this.cache.entries()).map(([key, entry]) => ({ |
| 128 | key, |
| 129 | size: entry.size, |
| 130 | age: Date.now() - entry.timestamp, |
| 131 | valid: this.isValid(entry) |
| 132 | })); |
| 133 | |
| 134 | const totalSize = entries.reduce((sum, e) => sum + e.size, 0); |
| 135 | |
| 136 | return { |
| 137 | entryCount: this.cache.size, |
| 138 | maxSize: this.maxSize, |
| 139 | totalSize, |
| 140 | entries |
| 141 | }; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | // Create singleton instance |