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

memcache-plus

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memcache-plus - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

29

lib/client.js

@@ -12,3 +12,4 @@ /**

Promise = require('bluebird'),
Queue = require('collections/deque');
Queue = require('collections/deque'),
R = require('ramda');

@@ -41,2 +42,3 @@ var Connection = require('./connection');

hosts: null,
types: false,
reconnect: true

@@ -229,4 +231,4 @@ });

*
* @param {String} key - The key to set
* @param {Function} [cb] - The value to set for this key. Can be of any type
* @param {String} key - The key to get
* @param {Function} [cb] - The (optional) callback called on completion
* @returns {Promise}

@@ -236,4 +238,23 @@ */

assert.ok(key, 'Cannot get without key!');
if (_.isArray(key)) {
return this.getMulti(key, cb);
} else {
return this.run('get', [key], cb);
}
};
return this.run('get', [key], cb);
/**
* getMulti() - Get multiple values for the provided array of keys
*
* @param {Array} keys - The keys to get
* @param {Function} [cb] - The value to set for this key. Can be of any type
* @returns {Promise}
*/
Client.prototype.getMulti = function(keys, cb) {
var self = this;
assert.ok(keys, 'Cannot get without key!');
return Promise.all(R.map(function(key) {
return self.run('get', [key], cb);
}, keys));
};

@@ -240,0 +261,0 @@

5

package.json
{
"name": "memcache-plus",
"version": "0.0.4",
"version": "0.0.5",
"description": "Better memcache for node",

@@ -45,4 +45,5 @@ "main": "index.js",

"hashring": "^2.0.1",
"lodash": "^2.4.1"
"lodash": "^2.4.1",
"ramda": "^0.2.3"
}
}

@@ -174,2 +174,38 @@ require('chai').should();

});
describe('getMulti', function() {
it('exists', function() {
cache.should.have.property('getMulti');
});
it('works', function() {
var val1 = chance.word(),
val2 = chance.word();
return Promise.all([cache.set('val1', val1), cache.set('val2', val2)])
.then(function() {
return cache.getMulti(['val1', 'val2']);
})
.then(function(vals) {
vals.should.be.an('array');
vals[0].should.equal(val1);
vals[1].should.equal(val2);
});
});
it('get with array of keys delegates to getMulti', function() {
var val1 = chance.word(),
val2 = chance.word();
return Promise.all([cache.set('val1', val1), cache.set('val2', val2)])
.then(function() {
return cache.get(['val1', 'val2']);
})
.then(function(vals) {
vals.should.be.an('array');
vals[0].should.equal(val1);
vals[1].should.equal(val2);
});
});
});
});

@@ -176,0 +212,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