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

cache-manager

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-manager - npm Package Compare versions

Comparing version 1.5.0 to 2.0.0

5

History.md

@@ -0,3 +1,6 @@

- 2.0.0 2015-03-13
- Removing domain integration (#38), no longer actively supporting node 0.10.x.
- 1.5.0 2015-03-13
-npm bumps, making sure global.Promise is not defined in node 0.10 memory store test.
- npm bumps, making sure global.Promise is not defined in node 0.10 memory store test.

@@ -4,0 +7,0 @@ - 1.4.1 2016-03-13

/** @module cacheManager/caching */
/*jshint maxcomplexity:15*/
var domain = require('domain');
var CallbackFiller = require('./callback_filler');

@@ -95,3 +94,3 @@

var hasKey = callbackFiller.has(key);
callbackFiller.add(key, {cb: cb, domain: process.domain});
callbackFiller.add(key, {cb: cb});
if (hasKey) { return; }

@@ -105,8 +104,3 @@

} else {
domain
.create()
.on('error', function(err) {
callbackFiller.fill(key, err);
})
.bind(work)(function(err, data) {
work(function(err, data) {
if (err) {

@@ -113,0 +107,0 @@ callbackFiller.fill(key, err);

11

lib/callback_filler.js

@@ -1,3 +0,1 @@

var domain = require('domain');
function CallbackFiller() {

@@ -8,10 +6,7 @@ this.queues = {};

CallbackFiller.prototype.fill = function(key, err, data) {
var self = this;
var waiting = this.queues[key];
delete this.queues[key];
var waiting = self.queues[key];
delete self.queues[key];
waiting.forEach(function(task) {
var taskDomain = task.domain || domain.create();
taskDomain.bind(task.cb)(err, data);
(task.cb)(err, data);
});

@@ -18,0 +13,0 @@ };

/** @module cacheManager/multiCaching */
var async = require('async');
var domain = require('domain');
var CallbackFiller = require('./callback_filler');

@@ -221,3 +220,3 @@

var hasKey = callbackFiller.has(key);
callbackFiller.add(key, {cb: cb, domain: process.domain});
callbackFiller.add(key, {cb: cb});
if (hasKey) { return; }

@@ -236,10 +235,3 @@

} else {
domain
.create()
.on('error', function(err) {
if (callbackFiller.has(key)) {
callbackFiller.fill(key, err);
}
})
.bind(work)(function(err, data) {
work(function(err, data) {
if (err) {

@@ -246,0 +238,0 @@ return callbackFiller.fill(key, err);

{
"name": "cache-manager",
"version": "1.5.0",
"version": "2.0.0",
"description": "Cache module for Node.js",

@@ -23,3 +23,3 @@ "main": "index.js",

"dependencies": {
"async": "^1.5.2",
"async": "1.5.2",
"lru-cache": "4.0.0"

@@ -26,0 +26,0 @@ },

@@ -579,8 +579,16 @@ // TODO: These are really a mix of unit and integration tests.

it("bubbles up that error", function(done) {
it("does not catch the error", function(done) {
var originalExceptionHandler = process.listeners('uncaughtException').pop();
process.removeListener('uncaughtException', originalExceptionHandler);
process.once('uncaughtException', function(err) {
process.on('uncaughtException', originalExceptionHandler);
assert.ok(err);
done();
});
cache.wrap(key, function() {
throw fakeError;
}, function(err) {
assert.equal(err, fakeError);
done();
}, function() {
done(new Error('Should not have caught error'));
});

@@ -587,0 +595,0 @@ });

@@ -929,8 +929,16 @@ var assert = require('assert');

it("bubbles up that error", function(done) {
it("does not catch the error", function(done) {
var originalExceptionHandler = process.listeners('uncaughtException').pop();
process.removeListener('uncaughtException', originalExceptionHandler);
process.once('uncaughtException', function(err) {
process.on('uncaughtException', originalExceptionHandler);
assert.ok(err);
done();
});
multiCache.wrap(key, function() {
throw fakeError;
}, ttl, function(err) {
assert.equal(err, fakeError);
done();
}, function() {
done(new Error('Should not have caught error'));
});

@@ -937,0 +945,0 @@ });

Sorry, the diff of this file is not supported yet

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