next.js
32f6ed39 - improve segment cache lru typesafety (#87129)

Commit
32 days ago
improve segment cache lru typesafety (#87129) The LRU and cache map code was using any types in several places `(MapEntry<any>`,` type LRUNode = MapEntry<any>`) which meant we had no type safety for those operations. This masked a bug fixed in #87124 where `deleteFromCacheMap(tail.value)` was being called incorrectly - the `any` typing let it compile when it shouldn't have. This PR introduces a `LRUNode` type that captures the structure needed for heterogeneous LRU operations (since the LRU holds both `RouteCacheEntry` and `SegmentCacheEntry`). The generic `MapEntry<V>` is kept for type-safe map operations, while `LRUNode` is used for deletion and LRU logic.
Author
Parents
Loading