Express middleware for aggressive yet obedient HTTP response caching with support for in-memory and Redis stores. Current stable version is 2.1.6, released as a mature library with TypeScript types included. Key differentiators: it caches by default unless Cache-Control explicitly forbids it, respects s-maxage over max-age, provides purge API by cache tag, and sets x-cache headers for hit/miss visibility. Built for Node >=8, it is fully tested and suitable for API/SRR caching with plug-and-play setup.
npm install express-aggressive-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage with default in-memory store, 1-hour max age, and application-wide caching.
Set maxAge explicitly to avoid unbounded memory usage. In v2 onwards, default maxAge is still Infinity; always configure a limit.
Update from app.use(cache()) to app.use(cache().middleware).
Use Cache-Control headers on responses instead.
Consider using Redis store for large-scale apps or set a reasonable max limit for memoryStore.
Do not rely on immediate memory after purge; use for cache invalidation only.
Use import cache from 'express-aggressive-cache' and then cache().middleware.
Run npm install express-aggressive-cache
Update package to >=2.0.0 and access .middleware property.
Use either 'memory' (string) or a custom store that implements the Store interface (e.g., from 'express-aggressive-cache/store/redis').