public function DrupalMemcache::addServer in Zircon Profile 8
Same name and namespace in other branches
- 8.0 modules/memcache/src/DrupalMemcache.php \Drupal\memcache\DrupalMemcache::addServer()
@
Overrides DrupalMemcacheInterface::addServer
File
- modules/
memcache/ src/ DrupalMemcache.php, line 30 - Contains \Drupal\memcache\DrupalMemcache.
Class
- DrupalMemcache
- Class DrupalMemcache.
Namespace
Drupal\memcacheCode
public function addServer($server_path, $persistent = FALSE) {
list($host, $port) = explode(':', $server_path);
// Support unix sockets in the format 'unix:///path/to/socket'.
if ($host == 'unix') {
// When using unix sockets with Memcache use the full path for $host.
$host = $server_path;
// Port is always 0 for unix sockets.
$port = 0;
}
// When using the PECL memcache extension, we must use ->(p)connect
// for the first connection.
return $this
->connect($host, $port, $persistent);
}