* Removes a specific key from the cache. * Updates both the hash map and doubly-linked list. * * Note: This is an explicit removal and does NOT trigger the `onEvict` * callback. Use this for intentional deletions where eviction tracking * is not needed. * * Time Complexity: O(1)
(key: string)
| 213 | * Time Complexity: O(1) |
| 214 | */ |
| 215 | public remove(key: string): void { |
| 216 | const node = this.cache.get(key) |
| 217 | if (!node) return |
| 218 | |
| 219 | this.removeNode(node) |
| 220 | this.cache.delete(key) |
| 221 | this.totalSize -= node.size |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * Returns the number of items in the cache. |
no test coverage detected