node-cache

A simple, fast in-memory caching module for Node.js with TTL expiration, similar to memcached.

Library
npm
v5.1.2
2,372stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity0
Maintenance20
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
67/100Good
Architecture65
Code Quality70
Innovation45
Learning Curve88

node-cache is an in-process key-value cache for Node.js that stores everything in a single in-memory object, giving set, get, mset, and del methods along with per-key or global TTL (time-to-live) expiration. It behaves conceptually like memcached but runs entirely inside the Node.js process, so there’s no separate cache server to run or network hop to pay for.

The cache supports both cloned and reference-based storage of values (useClones), an expired event for handling keys as they time out, an optional key-count limit, and a legacy callback-based API for older codebases migrating from earlier major versions. The project has publicly declared it will not be sold or handed to a new maintainer, and while it is described by its own maintainers as effectively unmaintained, it remains one of the most widely depended-on caching primitives in the npm ecosystem.

What You Get

  • A NodeCache class with set, get, mget, mset, del, take, and has methods
  • Per-key or global stdTTL expiration with a configurable background checkperiod sweep
  • An expired event emitted when a key times out, so consumers can react before/after deletion
  • useClones option to choose between deep-cloned values (safety) or stored references (performance)
  • A maxKeys limit to cap total cache size and reject new keys once full
  • An optional legacy callback-based API (enableLegacyCallbacks) for compatibility with pre-5.x code

Common Use Cases

  • Caching expensive computed values or database query results in-process for a short TTL window
  • Rate-limiting or deduplication bookkeeping where a lightweight expiring key-value store is sufficient
  • Memoizing API responses inside a server process without standing up Redis or memcached
  • Storing session-like or short-lived state in single-instance Node.js applications and scripts

Under The Hood

Architecture: The implementation lives in _src/lib/node_cache.coffee (716 lines), a CoffeeScript source compiled to the published index.js/index.d.ts. Internally, NodeCache keeps all entries in one plain JavaScript object keyed by string, with per-entry metadata (value, ttl timestamp) attached; a periodic checkperiod timer sweeps this object to find and evict expired keys, emitting the expired event, rather than scheduling a separate timer per key — a design that trades slight expiration-timing imprecision for much lower per-key overhead at scale (the README notes a practical limit around ~1M keys given the single-object model). The clone npm dependency is used when useClones is enabled to deep-copy stored/retrieved values so callers can’t accidentally mutate cached state through a shared reference. Tech Stack: Source is CoffeeScript, compiled via a Grunt build pipeline (Gruntfile.coffee, grunt-contrib-coffee) into the published CommonJS index.js with hand-maintained TypeScript typings (index.d.ts); the only runtime dependency is clone; tests run through mocha+nyc (coverage via Coveralls) with a separate TypeScript compile step (tsc) to validate the type definitions. Code Quality: _src/test/mocha_test.coffee is a substantial 1330-line test suite covering TTL expiration, cloning behavior, multi-key operations, and the expired event, plus a dedicated typedefinition_test.ts validating the TypeScript types compile and behave as declared — a solid quality bar for the era the code was written in. The project has had effectively no commits since mid-2024 and its own README states plainly that it is unmaintained, so bugs or Node.js compatibility issues are unlikely to be fixed upstream. API Design: The set/get/del naming and behavior deliberately mirror memcached, so anyone with prior cache experience can start using it immediately; the promised v6.x TypeScript rewrite (mentioned in the README but not yet shipped) signals the maintainers are aware the CoffeeScript-sourced internals are a maintenance liability without changing the public API surface consumers already depend on.

Used by 11 apps in this directory

TypeScript
99%
Other

Activepieces

Automation · AI Assistants

23,887

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
65
Dependency
Built with
TypeScript99%
Updated today
Python
86%
MIT

ai-toolkit

AI Development · AI Design Tools

11,757

An all-in-one open-source training suite for finetuning diffusion models—FLUX, SDXL, Wan video, and audio—on consumer GPU hardware via CLI or web UI.

View details
77
Repo Health
66
Technical
75
Dependency
Built with
Python86%
TypeScript13%
Updated 2 days ago
TypeScript
92%
MIT

Dittofeed

Marketing · Automation

2,903

Open-source omni-channel customer engagement platform for automating transactional and marketing messages via email, SMS, WhatsApp, Slack, and mobile push.

View details
54
Repo Health
75
Technical
63
Dependency
Built with
TypeScript92%
Updated 4 months ago
TypeScript
56%
MIT

Jitsu

Data Engineering

5,035

Open-source, fully-scriptable data ingestion engine that streams events from web, apps, and APIs to any data warehouse in real time.

View details
89
Repo Health
79
Technical
68
Dependency
Built with
TypeScript56%
Go41%
Updated today
Svelte
49%

Kener

Monitoring · Devops

5,114

Stunning, self-hosted status pages with real-time uptime monitoring, incident management, and multi-channel notifications in a single Docker container.

View details
85
Repo Health
76
Technical
68
Dependency
Built with
Svelte49%
TypeScript47%
Updated 2 weeks ago
TypeScript
96%
Other

Lightdash

Analytics · Data Engineering

6,056

The open-source Looker alternative that turns your dbt project's metrics and dimensions into governed, self-serve charts and dashboards — no license key required.

View details
93
Repo Health
84
Technical
66
Dependency
Built with
TypeScript96%
Updated today
TypeScript
86%
MIT

medusa

Ecommerce

35,900

The most flexible open-source commerce platform — build B2C, B2B, and marketplace applications with modular, composable commerce primitives.

View details
94
Repo Health
87
Technical
65
Dependency
Built with
TypeScript86%
JavaScript14%
Updated today
JavaScript
94%
AGPL 3.0

MyApi

AI Agents

23

A privacy-first personal API gateway for AI agents — connect your services once, issue scoped tokens to agents like OpenClaw, Hermes, or Claude Code, and keep a full audit trail instead of scattering raw credentials across .env files.

View details
32
Repo Health
64
Technical
74
Dependency
Built with
JavaScript94%
Updated yesterday
Vue
41%
AGPL 3.0

Operational

Analytics · Automation · Monitoring

476

Open-source event tracker with real-time push notifications and action buttons for tech founders.

View details
57
Repo Health
68
Technical
72
Dependency
Built with
Vue41%
JavaScript38%
MDX13%
Updated 3 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search