
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
redis-cache-express
Advanced tools
This library implements an Express middleware that allows for caching of HTML / JSON web responses using a Redis store.
Note:
200 HTTP status codenpm install --save redis-express-cache
/*
Scenario:
- You have an already existing node-redis instance
- Connected node-redis instance is passed to the cache-redis middleware
*/
var app = express()();
var redis_cache = require('redis-express-cache');
var redis = require('redis');
var client = redis.createClient();
var options = { client: redis_client };
redis_cache = redis_cache(options).middleware;
app.get('/url_to_cache', function (req, res) {
res.send('Will cache this response!')
}, redis_cache)
app.listen(3000, function () {
console.log('Starting up!')
});
/*
Scenario:
- A connected Redis client is not provided
- Connection options ( host and port ) are provided instead
- Middleware will attempt a connection on provided connection params
*/
var app = express()();
var redis_cache = require('redis-express-cache');
var connection_options = { port: 6379, host: 'localhost' }
redis_cache = redis_cache(connection_options).middleware;
app.get('/url_to_cache', function (req, res) {
res.send('Will cache this response!')
}, redis_cache)
/*
Scenario:
- A connected Redis client is not provided
- Connection options ( host and port ) are not provided either
- Middleware will attempt a connection to Redis on default values ( localhost : 6379 )
*/
var app = express()();
var redis_cache = require('redis-express-cache')().middleware;
app.get('/url_to_cache', function (req, res) {
res.send('Will cache this response!')
}, redis_cache)
/*
Scenario:
- For a cached URL : http://www.example-domain.com/cached_path
- Purge it using : http://www.example-domain.com/cached_path?refresh_cache=8c8c279a7a98069d432271c8db9d7df2
*/
var hash_value = '8c8c279a7a98069d432271c8db9d7df2'
var refresh_key = 'refresh_cache';
var options = {
invalidate: {
param_key: refresh_key,
param_value: hash_value
}
}
var redis_cache = redis_cache(options).middleware;
app.get('/url_to_cache', function (req, res) {
res.send('Will cache this response!')
}, redis_cache)
client will be used/* Usage */
var options = { client: redis.createClient() }
/* Usage */
var options = { ttl: 86400 } /* Cache for 1 day */
host + url path instead of just the url path (default)/some/random/pathwww.some-domain.com/some/random/path/* Usage */
var options = { include_host: true } /* Cache for 1 day */
https://www.url.com/path_to_cachehttps://www.url.com/path_to_cache?refresh_cache=true/* Usage */
var options = {
invalidate: {
param_key: 'refresh_cache',
param_value: 'true'
}
}
FAQs
Provides a seamless way to cache response data when using express
The npm package redis-cache-express receives a total of 86 weekly downloads. As such, redis-cache-express popularity was classified as not popular.
We found that redis-cache-express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.