// the find
kwhitley/apicache
Simple API-caching middleware for Express/Node.
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.