| Server IP : 185.208.173.17 / Your IP : 87.236.161.98 Web Server : Microsoft-IIS/10.0 System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64 User : IUSR ( 0) PHP Version : 7.4.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/parsmega.nuxt/node_modules/memcache-plus/docs/ |
Upload File : |
# Disconnect
### Basic case
In order to disconnect and close any and all open connections, simply call the
`disconnect()` method on the client:
```javascript
client
.disconnect()
.then(function() {
console.log('Successfully disconnected from all clients!');
});
```
### Disconnect from a specific host or hosts
However, if you would like to disconnect from a single host or list of hosts
but keep connections to the rest, you can do so by calling disconnect and
specifying either a single connection (as a string) or multiple (as an array)
and Memcache Plus will disconnect from only those you specify
```javascript
// Single as a string
client
.disconnect('myserver.com:11211')
.then(function() {
console.log('Successfully disconnected from only myserver.com:11211');
});
// Multiple as an array
client
.disconnect(['myserver1.com:11211', 'myserver2.com:11211'])
.then(function() {
console.log('Disconnected from myserver1.com:11211 AND myserver2.com:11211');
});
```
Note, if you specify a full disconnect `disconnect()` or specify all currently
open connections, the `reconnect` option will be automatically set to `false`.
Otherwise you'll close the connection and Memcache Plus will automatically try
to reconnect which of course you don't want!