# lru-cache: 8.2 out of 10

A strong pick. 2nd of 10 in [Caching and Redis clients](https://elestia.ai/opensource/caching/index.md).

lru-cache is the standard in-process LRU cache for JavaScript. It has bounds by count, size and TTL, stale-while-revalidate fetching, no dependencies and built-in types. For a single-process memory cache it is the default pick today. It does not share data between processes, so a Redis client is still needed for a shared cache.

**Best for:** Node.js or browser code that needs a fast, bounded in-memory cache inside one process, with no extra dependencies.

## Scores

- **Overall: 8.2** (likely 7.3 to 8.8)
  - Claude Opus 5.5 (8.0): For an in-process cache it is the default choice: complete, fast, typed, dependency-free and trusted across the ecosystem. It does not do Redis or shared caching, so ioredis, node-redis or Keyv still cover that part of the category. Reliance on one maintainer and a weak Scorecard keep it from a 9.
  - GPT-6.2 Sol (8.3): For a new single-process cache, lru-cache is a stronger choice than node-cache thanks to explicit size limits, async refresh, and current maintenance. Keyv offers a cache API backed by Redis, and node-redis provides direct access to Redis commands. Concentrated release activity, a recent compatibility regression, and below-median adoption growth temper the recommendation.
- **Needed by many: 6.0** (likely 4.9 to 7.1)
  - Claude Opus 5.5 (6.0): Many backend and tooling projects need an in-process memory cache, and it runs in Node and in browsers. It covers only the in-memory half of the category, not Redis or shared caching. That is a large group but not most developers.
  - GPT-6.2 Sol (5.9): A bounded local cache is useful in servers, browsers, and developer tooling. Each process keeps a separate copy, so the fit narrows when replicas need shared state. Runtime surveys show a large potential audience, but how often those projects need an explicit local cache is uncertain.
- **Helps a lot: 8.6** (likely 7.6 to 9.3)
  - Claude Opus 5.5 (8.5): It is the most complete in-memory LRU on npm: count, size and TTL bounds, dispose hooks, async fetch with deduplication and stale-while-revalidate, and diagnostics_channel metrics, all in TypeScript. Third-party benchmarks put it close to the fastest LRUs; a few micro-libraries are slightly faster at simple get and set. Its limits come from its design: it keeps data in one process only, and its TTL is loose.
  - GPT-6.2 Sol (8.7): Version 11.5.3 combines precise eviction limits, typed examples, per-entry expiry, and async refresh in a straightforward API. Expiry is lazy by default, so a TTL alone can leave a cache growing. An independent benchmark found good eviction throughput on Node and Bun, with smaller libraries ahead on some workloads.
- **Holds up over time: 7.4** (likely 6.3 to 8.5)
  - Claude Opus 5.5 (7.5): It is in active use and maintenance: 66 commits and 17 npm versions in the last year, the last in September 2026, with only 4 open issues. v11 has been stable since 2024 and only adds features in minor versions. The main risk is that one maintainer does most of the work; 18 pull requests are open and the Scorecard rates maintenance low.
  - GPT-6.2 Sol (7.3): The project made 66 commits and published 17 npm versions over the past year, with releases slowing to two patches since May. Recent release commits center on one maintainer, and GitHub Sponsors shows a way to fund the work. Users reported that 11.3.0 broke some jsdom and Vitest setups, and the maintainer addressed the underlying import issue within days. That response is encouraging, while concentrated release activity leaves the two-year outlook less certain.
- **Used widely: 8.3** (likely 6.9 to 9.1)
  - Claude Opus 5.5 (9.0): It has 1.2 million dependent repositories, the most in the category, ahead of Keyv. Its 3.2 billion downloads in four weeks are mostly transitive, through npm, glob and similar tools. The download ratio of about 3.1 is below the 4.1 median, so its share is stable to slightly falling. Even after these corrections, direct use runs to hundreds of thousands of projects.
  - GPT-6.2 Sol (7.5): Ecosyste.ms found about 1.2 million dependent repositories and 6,362 dependent packages, the highest repository count in this group and slightly ahead of Keyv. Many installs come through other packages, and older versions still account for a large share, so direct adoption is hard to estimate. Four-week downloads grew 3.12× year over year, below the 4.1× catalog median and behind Keyv and ioredis, indicating a loss of relative ground.
- **Vouched for: 8.1** (likely 7.0 to 9.1)
  - Claude Opus 5.5 (8.0): Core tooling such as the npm CLI and glob runs it in production at huge scale. Independent comparisons recommend it as the production choice for in-memory caching, and other libraries benchmark themselves against it. There is no survey data for this kind of utility, and Hacker News and Bluesky barely discuss it.
  - GPT-6.2 Sol (8.2): Apollo Server uses it for its default in-memory cache, and jsdom directly declares 11.5.3 as its minimum version. An independent benchmark adds current performance evidence for a specific eviction workload. The range reflects limited evidence on developer satisfaction and performance across real application workloads.
- **Safe: 7.9** (likely 6.8 to 9.0)
  - Claude Opus 5.5 (8.0): It has zero runtime dependencies, no OSV advisories ever, and a permissive BlueOak-1.0.0 licence, so the attack surface is small. The Scorecard is only 4: there is no code review, token permissions and dependency pinning are weak, and one person publishes releases. Its huge transitive reach makes the publish account a high-value target.
  - GPT-6.2 Sol (7.8): Zero runtime dependencies, no recorded OSV advisories, and the permissive Blue Oak Model License 1.0.0 keep dependency risk low. OpenSSF Scorecard gives it 4 out of 10, with zeroes for code review, workflow token permissions, dependency pinning, and fuzzing. The release scripts invoke npm publish directly, and uncertainty about the publisher roster and release provenance widens the range.

## Good

- Zero dependencies, written in TypeScript, with a minified export.
- Bounds by item count, by total size through sizeCalculation, and by TTL.
- fetchMethod deduplicates in-flight loads and supports stale-while-revalidate, which helps prevent cache stampedes.
- Battle-tested: npm's own tooling and over a million repositories depend on it.

## Bad

- Memory only and per process: no persistence and no cache shared across instances.
- TTL is not strictly enforced; for a TTL-only cache the same author points to @isaacs/ttlcache.
- One maintainer does most of the releases, and the OpenSSF Scorecard is a low 4 (no code review, unpinned dependencies).
- Majors v7 to v10 came close together, with changes to exports and types that broke some upgrades.

## The numbers

- Downloads, 4 weeks: 3.2B
- In a year: ×3.1
- GitHub stars: 5.9k
- Commits, 12 months: 66
- Last npm release: Sept 2026
- Advisories, 24 months: 0
- Licence: BlueOak-1.0.0
- GitHub: https://github.com/isaacs/node-lru-cache
- npm: https://www.npmjs.com/package/lru-cache

Many packages install it, so most downloads are not a direct choice.

Scores run from 0 to 10 and are the mean of the scores of AI reviewers (Claude Opus 5.5, GPT-6.2 Sol), made on 22 November 2026 from GitHub, npm, OSV, OpenSSF Scorecard, ecosyste.ms, Hacker News and Bluesky data and a web search. The ecosyste.ms count of repositories that use a project is far too low for projects that grew in the last few years, and some reviews quote it. Overall is the reviewers' own judgement for a new project today, not an average of the parts. An AI wrote them and can be wrong.
