Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cache-manager-express-mw

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-manager-express-mw - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

2

package.json
{
"name": "cache-manager-express-mw",
"version": "0.0.3",
"version": "0.0.4",
"description": "Middleware for Express that uses cache-manager to add a caching layer in front of your application.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -9,2 +9,6 @@ var _ = require("lodash"),

var isProduction = function() {
return process.env.NODE_ENV === "production";
};
var getMaxAge = function(res) {

@@ -27,6 +31,7 @@ var cacheControlHeader = res.get("Cache-Control");

if (err) {
reject(err);
} else {
resolve(result);
if (!isProduction()) {
console.warn("Error retrieving value from cache: " + err);
}
}
resolve(result);
});

@@ -43,6 +48,7 @@ });

if (err) {
reject(err);
} else {
resolve(result);
if (!isProduction()) {
console.warn("Error retrieving ttl from cache: " + err);
}
}
resolve(result);
});

@@ -79,3 +85,7 @@ });

if (/^2/.test(res.statusCode)) {
cache.set(key, { statusCode: res.statusCode, body: body }, { ttl: getMaxAge(res) });
cache.set(key, { statusCode: res.statusCode, body: body }, { ttl: getMaxAge(res) }, function(err) {
if (!isProduction()) {
console.warn("Error setting value in cache: " + err);
}
});
}

@@ -105,2 +115,8 @@

}
})
.catch(error => {
if (!isProduction()) {
console.warn("Error accessing cache: " + err);
}
next();
});

@@ -107,0 +123,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc