Middleware for Express apps that automatically caches HTTP responses in Redis, reducing server load and improving response times for frequently accessed routes. Version 1.1.3 is the latest stable release, with no active development since 2017. It provides a simple drop-in middleware interface and supports custom cache keys, conditional caching, and multiple Redis clients. Compared to alternatives like apicache or express-cache-controller, it uses Redis as a persistent, shared cache store suitable for distributed deployments. However, it is no longer maintained and has known issues with newer Express versions and Redis client libraries.
npm install express-redis-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an Express server that caches the root route response in Redis using the express-redis-cache middleware.
Consider migrating to actively maintained alternatives like apicache or express-cache-controller.
Force install redis@3 or higher by overriding in package.json, though compatibility is not guaranteed.
Set a custom prefix via the constructor options: { prefix: 'myapp' }Always invoke cache.route() as cache.route() or cache.route('name')Use res.send() instead of res.json() for routes that are cached, or patch the middleware.
Start Redis server: redis-server, or verify REDIS_HOST and REDIS_PORT environment variables.
Correct: const cache = require('express-redis-cache')({ host: 'localhost' });Ensure Redis is running and the client is properly configured: require('express-redis-cache')({ client: redis.createClient() })Use '127.0.0.1' instead of 'localhost' in the host option.