# isaacs/node-lru-cache

A fast cache that automatically deletes the least recently used items

Repository: https://github.com/isaacs/node-lru-cache
Canonical: https://ross.abutalabs.com/products/node-lru-cache
Homepage: http://isaacs.github.io/node-lru-cache/
Language: JavaScript
License: BlueOak-1.0.0
License Family: other
Topics: cache, caching, lru, lru-cache, lrucache
Last push: 2026-07-07T23:26:59+00:00

## Health v2 (maintenance only)
Score: 73/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 91, release rhythm 35, longevity 100
- inputs: {"age_days": 5948, "days_push": 57, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 5910, forks 375 (observed 2026-08-28T04:09:32.167257+00:00)

## What it is
A high-performance JavaScript LRU (least-recently-used) cache library for Node.js and browsers, with optional TTL support, size tracking, and stale-while-revalidate fetching. It is a hybrid ESM/CJS module with zero dependencies.

## Use cases
- cache expensive function results in memory with a bounded size
- evict least recently used items when a cache hits its max size
- add per-item TTL expiration to an in-memory cache
- implement stale-while-revalidate fetching in JavaScript
- limit memory usage of cached objects with size calculation
- speed up repeated lookups in a Node.js application

## When to choose
- you need a fast, well-tested in-memory LRU cache in JavaScript
- you want optional TTL, size limits, and eviction callbacks in one cache
- you need a dependency-free cache that works in both Node.js and browsers

## When to avoid
- you need strong TTL guarantees with preemptive expiration pruning
- you need a distributed or persistent cache across processes or servers
- you primarily need TTL caching rather than LRU eviction

## Facets
- artifact type: library
- maturity: stable
- function: caching
- domain: developer-tools, performance, web-development
- platform: browser
- tags: lru, in-memory-cache, ttl, eviction-policy, zero-dependency, nodejs, javascript

## Member repositories
- isaacs/node-lru-cache (main) score 73

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:32.167257+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:51:16.835367+00:00, confidence not recorded.
  - readme: https://github.com/isaacs/node-lru-cache (fetched 2026-08-28T04:09:32.167257+00:00, sha fe9133209ca9)
  - homepage: http://isaacs.github.io/node-lru-cache/ (fetched 2026-08-29T08:46:56.408228+00:00, sha 91b695c94fb8)
- Data as of 2026-08-30T08:39:29.467469+00:00.
