There are too many LRU(Least Recently Used) implementations in JS.
I recommend to use [flru] which is the smallest one and fast enough. Unless you need more rich functionality.
However, it's performance is vary depend on the host environment. For example, flru loses on Bun.
If you need micro-optimization on it, measure it yourself in your environment.