finds.dev← search

// the find

isaacs/node-lru-cache

★ 5,897 · JavaScript · BlueOak-1.0.0 · updated May 2026

A fast cache that automatically deletes the least recently used items

A doubly-linked-list LRU cache with a decade of real-world hardening behind it. Maintained by isaacs (the guy who runs npm), so it's not going anywhere. If you need an in-process cache in Node or the browser and you don't want to think too hard about it, this is the correct answer.

Pre-allocates all storage upfront when `max` is set, which means no GC surprises under load. The `fetch()` method with stale-while-revalidate semantics handles concurrent cache misses gracefully — multiple callers for the same missing key coalesce into a single fetch instead of stampeding. Full TypeScript types, hybrid CJS/ESM output, and a minified browser build are all first-class outputs, not afterthoughts. The `node:diagnostics_channel` integration means you can tap cache hit/miss rates into your existing observability pipeline without wrapping every call.

TTL is explicitly not the primary use case and the library says so openly — if TTL is what you need, you're pointed to a sister package. The diagnostics channel has a platform-compatibility caveat where the first tick of your app won't be instrumented in some ESM environments, which is an annoying edge case in exactly the environments where you care about cold-start. `undefined` cannot be stored as a value, requiring a workaround sigil pattern that's easy to miss until you get a confusing cache miss. The benchmark suite is a separate sub-package with its own lockfile, which is more complexity than most people will ever use — it signals rigorous performance work, but it's also just maintenance overhead.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →