memcache-plus
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -278,8 +278,12 @@ /** | ||
*/ | ||
Client.prototype.getMulti = function(keys, cb) { | ||
Client.prototype.getMulti = function(keys, opts, cb) { | ||
var self = this; | ||
assert(keys, 'Cannot get without key!'); | ||
if (typeof opts === 'function' && typeof cb === 'undefined') { | ||
cb = opts; | ||
opts = {}; | ||
} | ||
return Promise.props(R.reduce(function(acc, key) { | ||
acc[key] = self.run('get', [key], null); | ||
acc[key] = self.run('get', [key, opts], null); | ||
return acc; | ||
@@ -286,0 +290,0 @@ }, {}, keys)).nodeify(cb); |
{ | ||
"name": "memcache-plus", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Better memcache for node", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -178,2 +178,29 @@ require('chai').should(); | ||
it('getMulti works with compression', function() { | ||
var key1 = getKey(), key2 = getKey(), | ||
val1 = chance.word(), val2 = chance.word(); | ||
return Promise.all([cache.set(key1, val1, { compressed: true }), cache.set(key2, val2, { compressed: true })]) | ||
.then(function() { | ||
return cache.getMulti([key1, key2], { compressed: true }); | ||
}) | ||
.then(function(vals) { | ||
vals.should.be.an('object'); | ||
vals[key1].should.equal(val1); | ||
vals[key2].should.equal(val2); | ||
}); | ||
}); | ||
it('get works with a callback', function(done) { | ||
var key = getKey(), val = chance.word({ length: 1000 }); | ||
return cache.set(key, val, { compressed: true }) | ||
.then(function() { | ||
cache.get(key, { compressed: true }, function(err, v) { | ||
val.should.equal(v); | ||
done(err); | ||
}); | ||
}); | ||
}); | ||
it('get for key that should be compressed but is not returns null', function() { | ||
@@ -180,0 +207,0 @@ var key = getKey(), val = chance.word({ length: 1000 }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51341
1227