isaacs/node-lru-cache

A fast cache that automatically deletes the least recently used items

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 51 minutes ago
Added to GitGenius on September 11th, 2026
Created on May 21st, 2010
Open Issues & Pull Requests: 3 (+0)
GitHub issues: Enabled
Number of forks: 373
Total Stargazers: 5,915 (+0)
Total Subscribers: 48 (+0)

Repository Insights (GitGenius)

Most active contributors

Sign in to see contributor activity.

Related repositories by overlapping contributors

No overlapping-contributor repos identified yet.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

node-lru-cache is a cache data structure that automatically deletes the least recently used items when capacity is reached.

The tool solves the problem of managing bounded memory in applications that need fast caching. It maintains a fixed number of the most recently accessed items, evicting older entries when the limit is exceeded. The implementation offers multiple bounding strategies: you can limit by item count using the max parameter, by total storage size using maxSize with per-item size calculation, or by time-to-live with optional automatic purging. The cache treats expired items as missing and deletes them on access rather than through preemptive pruning by default.

Developers should choose this tool when they need predictable memory consumption and fast access patterns based on recency. It suits applications requiring bounded caches without the complexity of TTL-focused solutions. The README explicitly distinguishes this from TTL caching, noting that if time-based expiration is the primary concern rather than LRU eviction, the separate ttlcache package is a better fit. The tool does not store undefined values, using undefined internally to indicate missing keys; the README suggests wrapping undefined values in a sigil object if tracking them is necessary. The implementation prioritizes performance and supports diverse use cases, though enabling certain features necessarily impacts speed by requiring additional work from the cache.

Maintainers typically respond to new issues and pull requests within a day.