Express middleware (v0.1.2, low activity) that adds a chainable `cacheControl` method to response objects for setting Cache-Control headers. Supports string patterns (public, private, no-cache, no-store), time strings for max-age (e.g. '1h'), and explicit option objects. Requires peer dependency express >=4.0.0. Unlike similar libraries like `express-cache-control`, it does not automatically set legacy Expires headers. Used by few projects; no recent updates.
npm install express-cache-controlfreakNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates two usage patterns: middleware with options and chainable res.cacheControl with pattern and options.
Use explicit options { noStore: true, noCache: false } to avoid including no-cache, or manually set header.Use explicit options { noStore: true, noCache: false } to avoid including no-cache, or manually set header.Always pass either a pattern string, an options object, or both.
Consider using 'helmet' or writing res.set('Cache-Control', 'public, max-age=31557600') directly.Use const cacheControl = require('express-cache-controlfreak'); (CommonJS) or import cacheControl from 'express-cache-controlfreak' (ESM).Ensure app.use(cacheControl()) or route-specific middleware is placed before the handler that uses res.cacheControl.
Use cacheControl({ maxAge: 300 }) for options-only, or cacheControl('public', { maxAge: 300 }) for both.Run npm install ms; or use numeric maxAge values instead of time strings.