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.1.0 to 0.1.1

5

lib/client.js

@@ -58,3 +58,3 @@ /**

Client.prototype.connect = function() {
debug('Connecting...');
debug('starting connection');
this.connections = {};

@@ -71,2 +71,3 @@

.then(function() {
debug('got host list, connecting to hosts');
// Connect to these hosts

@@ -123,2 +124,3 @@ this.connectToHosts();

Client.prototype.connectToHosts = function() {
debug('connecting to all hosts');
this.hosts.forEach(function(host) {

@@ -145,2 +147,3 @@ var h = this.splitHost(host);

if (this.buffer && this.buffer.length > 0) {
debug('flushing client write buffer');
// @todo Watch out for and handle how this behaves with a very long buffer

@@ -147,0 +150,0 @@ while(this.buffer.length > 0) {

17

lib/connection.js

@@ -72,2 +72,4 @@ /**

debug("connecting to host %s:%s", params.host, params.port);
// If a client already exists, we just want to reconnect

@@ -90,7 +92,7 @@ if (this.client) {

}
debug('Connection to memcache lost, reconnecting in %sms...', this.backoff);
debug('connection to memcache lost, reconnecting in %sms...', this.backoff);
setTimeout(function() {
// Only want to do this if a disconnect was not triggered intentionally
if (!self.disconnecting) {
debug('Attempting to reconnect to memcache now.', this.backoff);
debug('attempting to reconnect to memcache now.', this.backoff);
self.client.destroy();

@@ -106,3 +108,3 @@ self.connect();

this.client.on('connect', function() {
debug('Successfully reconnected!');
debug('successfully (re)connected!');
this.ready = true;

@@ -122,6 +124,6 @@ // Reset backoff if we connect successfully

carrier.carry(this.client, this.read.bind(this));
// this.client.on('data', this.read.bind(this));
};
Connection.prototype.read = function(data) {
debug('got data: %s', data.toString());
var deferred = this.queue.peek();

@@ -162,2 +164,3 @@ if (data.toString().substr(0, 5) === 'ERROR') {

if (this.writeBuffer && this.writeBuffer.length > 0) {
debug('flushing connection write buffer');
// @todo Watch out for and handle how this behaves with a very long buffer

@@ -171,2 +174,3 @@ while(this.writeBuffer.length > 0) {

Connection.prototype.write = function(str) {
debug('sending data: %s', str);
this.writeBuffer = this.writeBuffer || new Queue();

@@ -195,2 +199,3 @@ // If for some reason this connection is not yet ready and a request is tried,

Connection.prototype.autodiscovery = function() {
debug('starting autodiscovery');
var deferred = misc.defer('autodiscovery');

@@ -202,2 +207,3 @@ this.queue.push(deferred);

.then(function(data) {
debug('got autodiscovery response from elasticache');
// Elasticache returns hosts as a string like the following:

@@ -218,2 +224,3 @@ // victor.di6cba.0001.use1.cache.amazonaws.com|10.10.8.18|11211 victor.di6cba.0002.use1.cache.amazonaws.com|10.10.8.133|11211

Connection.prototype.set = function(key, val, ttl) {
debug('set %s:%s', key, val);
assert(typeof key === 'string', 'Cannot set in memcache with a not string key');

@@ -265,2 +272,3 @@ assert(key.length < 250, 'Key must be less than 250 characters long');

Connection.prototype.get = function(key) {
debug('get %s', key);
// Do the get

@@ -290,2 +298,3 @@ var deferred = misc.defer(key);

Connection.prototype.delete = function(key) {
debug('delete %s', key);
// Do the delete

@@ -292,0 +301,0 @@ var deferred = misc.defer(key);

{
"name": "memcache-plus",
"version": "0.1.0",
"version": "0.1.1",
"description": "Better memcache for node",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -55,2 +55,3 @@ require('chai').should();

* Ideally one day this can be mocked, but for now just selectively enabling it
*/
it('supports autodiscovery', function(done) {

@@ -69,3 +70,3 @@ var cache = new Client({ hosts: ['victor.di6cba.cfg.use1.cache.amazonaws.com'], autodiscover: true });

});
*/
/**/
});

@@ -72,0 +73,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