@vingle/memcache-plus
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -413,17 +413,3 @@ /** | ||
// group keys by node index | ||
const keysGroupedByNode = _.chain(keys) | ||
.groupBy(key => this.getConnectionName({ command: "get", args: [key] })) | ||
.map((keys, node) => ({ keys, node })) | ||
.value(); | ||
return Promise.all( | ||
keysGroupedByNode.map((group) => { | ||
return this.run('get_multi', [group.keys, opts]); | ||
}) | ||
).then( | ||
(results) => { | ||
return Object.assign({}, ...results) | ||
} | ||
).nodeify(cb); | ||
return this.run('get_multi', [keys, opts]).nodeify(cb); | ||
}; | ||
@@ -632,7 +618,28 @@ | ||
if (this.ready()) { | ||
// First, retrieve the correct connection out of the hashring | ||
var connection = this.getConnection({ command, args }); | ||
// For Multi Command | ||
if (command === "get_multi") { | ||
// group keys by node index | ||
const [keys, opt] = args; | ||
const keysGroupedByNode = _.chain(keys) | ||
.groupBy(key => this.getConnectionName({ command: "get", args: [key] })) | ||
.map((keys, node) => ({ keys, node })) | ||
.value(); | ||
// Run this command | ||
return connection[command].apply(connection, args).nodeify(cb); | ||
return Promise.all( | ||
keysGroupedByNode.map((group) => { | ||
var connection = this.connections[group.node]; | ||
return connection.get_multi(group.keys, opt); | ||
}) | ||
).then( | ||
(results) => { | ||
return Object.assign({}, ...results) | ||
} | ||
).nodeify(cb); | ||
} else { | ||
// First, retrieve the correct connection out of the hashring | ||
var connection = this.getConnection({ command, args }); | ||
// Run this command | ||
return connection[command].apply(connection, args).nodeify(cb); | ||
} | ||
} else if (this.bufferBeforeError === 0 || !this.queue) { | ||
@@ -639,0 +646,0 @@ return Promise.reject(new Error('Connection is not ready, either not connected yet or disconnected')).nodeify(cb); |
{ | ||
"name": "@vingle/memcache-plus", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Better memcache for node", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
310324
2755
1