memcache-plus
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -206,2 +206,18 @@ /** | ||
/** | ||
* deleteMulti() - Delete multiple items from the cache | ||
* | ||
* @param {Array} keys - The keys of the items to delete | ||
* @param {Function} [cb] - Callback to call when we have a value | ||
* @returns {Promise} | ||
*/ | ||
Client.prototype.deleteMulti = function(keys, cb) { | ||
var self = this; | ||
assert.ok(keys, 'Cannot delete without keys!'); | ||
return Promise.all(R.map(function(key) { | ||
return self.run('delete', [key], cb); | ||
}, keys)); | ||
}; | ||
/** | ||
* set() - Set a value for the provided key | ||
@@ -208,0 +224,0 @@ * |
{ | ||
"name": "memcache-plus", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Better memcache for node", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -256,2 +256,36 @@ require('chai').should(); | ||
describe('deleteMulti', function() { | ||
var cache; | ||
before(function() { | ||
cache = new Client(); | ||
}); | ||
it('exists', function() { | ||
cache.should.have.property('deleteMulti'); | ||
cache.deleteMulti.should.be.a('function'); | ||
}); | ||
it('works', function() { | ||
var key1 = chance.word(), | ||
key2 = chance.word(); | ||
return Promise.all([cache.set(key1, 'myvalue'), cache.set(key2, 'myvalue')]) | ||
.then(function() { | ||
return cache.deleteMulti([key1, key2]); | ||
}) | ||
.then(function() { | ||
return cache.get(key1); | ||
}) | ||
.catch(function(err) { | ||
err.type.should.equal('NotFoundError'); | ||
}) | ||
.then(function() { | ||
return cache.get(key2); | ||
}) | ||
.catch(function(err) { | ||
err.type.should.equal('NotFoundError'); | ||
}); | ||
}); | ||
}); | ||
describe('Helpers', function() { | ||
@@ -258,0 +292,0 @@ describe('splitHost()', function() { |
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
37637
917