node-cache

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

Library
npm
v5.1.2
2,373 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
44 /100 Fair
Development Activity 0
Maintenance 20
Community 56
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
67 /100 Good
Architecture 65
Code Quality 70
Innovation 45
Learning Curve 88

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 12 apps in this directory

TypeScript
100%
Other

Activepieces

AI Assistants · Automation · Mcp

24,756

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
64
Dependency
Built with
TypeScript 100%
Updated 4 days ago
Python
85%
MIT

ai-toolkit

AI Design Tools · AI Development

12,143

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
79
Repo Health
66
Technical
72
Dependency
Built with
Python 85%
TypeScript 14%
Updated 5 days ago
TypeScript
92%
MIT

Dittofeed

Automation · Marketing

2,968

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
62
Dependency
Built with
TypeScript 92%
Updated 6 months ago
TypeScript
62%
MIT

Jitsu

Data Engineering

5,094

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

View details
88
Repo Health
79
Technical
66
Dependency
Built with
TypeScript 62%
Go 36%
Updated 1 weeks ago
TypeScript
50%

Kener

Devops · Monitoring

5,181

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

View details
86
Repo Health
76
Technical
67
Dependency
Built with
TypeScript 50%
Svelte 47%
Updated 2 weeks ago
TypeScript
97%
Other

Lightdash

Analytics · Data Engineering

6,166

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
64
Dependency
Built with
TypeScript 97%
Updated 4 days ago
TypeScript
88%
MIT

medusa

Ecommerce

36,494

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

View details
93
Repo Health
87
Technical
63
Dependency
Built with
TypeScript 88%
JavaScript 12%
Updated 1 weeks ago
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
28
Repo Health
64
Technical
73
Dependency
Built with
JavaScript 94%
Updated 1 months ago
Vue
41%
AGPL 3.0

Operational

Analytics · Automation · Monitoring

475

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

View details
52
Repo Health
68
Technical
68
Dependency
Built with
Vue 41%
JavaScript 38%
MDX 13%
Updated 2 months 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