perf(router): replace LRU cache with optimized doubly-linked list implementation (#82633)
### What? Replace LRU cache implementation with an optimized doubly-linked list algorithm and move from server-only to shared library location. ### Why? The previous Map-based LRU cache had suboptimal eviction performance for route matching operations under high load. Route matching is a critical performance path in Next.js that benefits significantly from true O(1) cache operations. ### How? - Implement doubly-linked list with sentinel nodes for true O(1) get/set/delete operations - Add comprehensive test coverage including size-based eviction scenarios - Update import paths across 14 files throughout the codebase - Add defensive null checking for edge cases discovered during static analysis - Replace deprecated `keys()` iteration with modern `Symbol.iterator` pattern
Showing
Please
register
or
sign in
to comment