Socket
Socket
Sign inDemoInstall

memcached

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memcached - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

test/memcached-connections.test.js

1

AUTHORS.md

@@ -11,2 +11,3 @@ # Authors and contributors of the node Memcached driver project in alphabetical order.

- Ron Korving
- Sebastian Seilund
- Tobias Müllerleile

@@ -30,2 +30,3 @@ "use strict";

this.totalRetries = 0;
this.retry = 0;
this.totalReconnectsAttempted = 0;

@@ -32,0 +33,0 @@ this.totalReconnectsSuccess = 0;

26

lib/memcached.js

@@ -133,2 +133,4 @@ "use strict";

manager = new Jackpot(this.poolSize);
manager.retries = memcached.retries;
manager.factory(function factory() {

@@ -157,5 +159,2 @@ var S = Array.isArray(serverTokens)

}
, error: function streamError(err) {
memcached.connectionIssue(err, S, callback);
}
, data: curry(memcached, privates.buffer, S)

@@ -262,3 +261,2 @@ , timeout: function streamTimeout() {

if (error) return query.callback && query.callback(error);
if (!S) return query.callback && query.callback('Connect did not give a server');

@@ -297,6 +295,4 @@

// cache misses.
memcached.connectionIssue = function connectionIssue(error, S, callback) {
// end connection and mark callback as cache miss
memcached.connectionIssue = function connectionIssue(error, S) {
if (S && S.end) S.end();
if (callback) callback(false, false);

@@ -346,2 +342,5 @@ var issues

});
// bumpt the event listener limit
issues.setMaxListeners(0);
}

@@ -598,3 +597,3 @@

, tokenSet
, dataSet = ''
, dataSet
, resultSet

@@ -624,7 +623,3 @@ , metaData

if (tokenSet[0] === 'VALUE') {
while (S.bufferArray.length) {
if (privates.bufferedCommands.test(S.bufferArray[0])) break;
dataSet += S.bufferArray.shift();
}
dataSet = Utils.unescapeValue(S.bufferArray.shift());
}

@@ -681,4 +676,3 @@

// cleanup
dataSet = '';
tokenSet = metaData = undefined;
dataSet = tokenSet = metaData = undefined;

@@ -783,2 +777,4 @@ // check if we need to remove an empty item from the array, as splitting on /r/n might cause an empty

value = Utils.escapeValue(value);
length = Buffer.byteLength(value);

@@ -785,0 +781,0 @@ if (length > this.maxValue) {

@@ -132,1 +132,11 @@ "use strict";

};
//Escapes values by putting backslashes before line breaks
exports.escapeValue = function(value) {
return value.replace(/(\r|\n)/g, '\\$1');
};
//Unescapes escaped values by removing backslashes before line breaks
exports.unescapeValue = function(value) {
return value.replace(/\\(\r|\n)/g, '$1');
};
{
"name": "memcached"
, "version": "0.1.4"
, "version": "0.1.5"
, "author": "Arnout Kazemier"

@@ -5,0 +5,0 @@ , "description": "A fully featured Memcached API client, supporting both single and clustered Memcached servers through consistent hashing and failover/failure. Memcached is rewrite of nMemcached, which will be deprecated in the near future."

@@ -448,2 +448,95 @@ /**

});
/**
* Make sure that a string beginning with OK is not interpreted as
* a command response.
*/
it("set and get a string beginning with OK", function(done) {
var memcached = new Memcached(common.servers.single)
, message = 'OK123456'
, testnr = ++global.testnumbers
, callbacks = 0;
memcached.set("test:" + testnr, message, 1000, function(error, ok){
++callbacks;
assert.ok(!error);
ok.should.be.true;
memcached.get("test:" + testnr, function(error, answer){
++callbacks;
assert.ok(!error);
assert.ok(typeof answer === 'string');
answer.should.eql(message);
memcached.end(); // close connections
assert.equal(callbacks, 2);
done();
});
});
});
/**
* Make sure that a string beginning with OK is not interpreted as
* a command response.
*/
it("set and get a string beginning with VALUE", function(done) {
var memcached = new Memcached(common.servers.single)
, message = 'VALUE hello, I\'m not really a value.'
, testnr = ++global.testnumbers
, callbacks = 0;
memcached.set("test:" + testnr, message, 1000, function(error, ok){
++callbacks;
assert.ok(!error);
ok.should.be.true;
memcached.get("test:" + testnr, function(error, answer){
++callbacks;
assert.ok(!error);
assert.ok(typeof answer === 'string');
answer.should.eql(message);
memcached.end(); // close connections
assert.equal(callbacks, 2);
done();
});
});
});
/**
* Make sure that a string containing line breaks are escaped and
* unescaped correctly.
*/
it("set and get a string with line breaks", function(done) {
var memcached = new Memcached(common.servers.single)
, message = '1\n2\r\n3\n\r4\\n5\\r\\n6\\n\\r7'
, testnr = ++global.testnumbers
, callbacks = 0;
memcached.set("test:" + testnr, message, 1000, function(error, ok){
++callbacks;
assert.ok(!error);
ok.should.be.true;
memcached.get("test:" + testnr, function(error, answer){
++callbacks;
assert.ok(!error);
assert.ok(typeof answer === 'string');
answer.should.eql(message);
memcached.end(); // close connections
assert.equal(callbacks, 2);
done();
});
});
});
});

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