finds.dev

kwhitley/apicache

Simple API-caching middleware for Express/Node.

View on GitHub

★ 1,248JavaScriptMITupdated Jan 2023

// the take

apicache is Express/Node middleware that caches API responses in memory or Redis, configured with plain-English duration strings like '5 minutes'. It's for small-to-medium Express apps that want quick response caching without setting up a dedicated caching layer. Restify is also supported.

The plain-English duration API ('5 minutes', '1 hour') is genuinely pleasant and avoids the ms-calculation busywork you'd do manually. Cache grouping via req.apicacheGroup is a practical addition — invalidating an entire collection on a POST is exactly the pattern you need. The middlewareToggle parameter lets you skip caching for non-200 responses cleanly, which most hand-rolled solutions forget to handle. Redis and ioredis support drops in with just a client option, no restructuring required.

Last commit was January 2023 and the Travis CI badge points to a dead service — this project is effectively abandoned. The in-memory store has no size limit, so a high-cardinality route (e.g. /api/users/:id) will silently grow until the process OOMs. Cache keys are URL-based with optional appendKey, which means request body content is never part of the key — POST caching is a footgun. There's no stampede protection: if 50 requests hit an expired key simultaneously, all 50 will pass through to your handler before any response is cached.

We read the README, the directory tree and a key source file in June 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
1,248
Forks
191
Language
JavaScript
License
MIT
Last commit
24 Jan 2023

// nearby

If apicache isn't quite it.

All repos →