memcache-plus
Advanced tools
Comparing version 0.2.6 to 0.2.7
@@ -92,2 +92,24 @@ /** | ||
/** | ||
* disconnect() - Iterate over all hosts, disconnect from each. | ||
* | ||
* @api private | ||
*/ | ||
Client.prototype.disconnect = function() { | ||
debug('starting disconnection'); | ||
var connectionKeys = R.keys(this.connections); | ||
connectionKeys.map(function(ckey) { | ||
debug('disconnecting from %s', ckey); | ||
this.connections[ckey].disconnect(); | ||
}.bind(this)); | ||
this.connections = {}; | ||
// Fair to assume if client is requesting a disconnect, they don't want | ||
// it to just reconnect | ||
this.reconnect = false; | ||
return Promise.resolve(null); | ||
}; | ||
/** | ||
* getHostList() - Given a list of hosts, contact them via Elasticache | ||
@@ -94,0 +116,0 @@ * autodiscover and retrieve the list of hosts |
{ | ||
"name": "memcache-plus", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "Better memcache for node", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,2 +43,16 @@ require('chai').should(); | ||
it('has a disconnect method', function(done) { | ||
var cache = new Client(); | ||
cache.should.have.property('disconnect'); | ||
cache.disconnect.should.be.a('function'); | ||
_.sample(cache.connections).client.on('connect', function() { | ||
cache.disconnect() | ||
.then(function() { | ||
cache.connections.should.be.an('object'); | ||
_.keys(cache.connections).should.have.length(0); | ||
}) | ||
.then(done); | ||
}); | ||
}); | ||
it('has a dictionary of connections', function() { | ||
@@ -45,0 +59,0 @@ var cache = new Client(); |
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
76098
24
1335