public static function DrupalMemcachedUtils::parseServerInfo in Memcache Storage 8
Parses the string of memcached server.
Parameters
$memcached_server string: Examples of server string:
- unix:///path/to/memcached.socket
- 127.0.0.1:12111
Return value
array Processed host and port values.
2 calls to DrupalMemcachedUtils::parseServerInfo()
File
- src/
DrupalMemcachedUtils.php, line 20
Class
Namespace
Drupal\memcache_storageCode
public static function parseServerInfo($memcached_server) {
list($host, $port) = explode(':', $memcached_server);
// Support unix sockets in the format 'unix:///path/to/socket'.
if ($host == 'unix') {
// PECL Memcache requires string format like 'unix:///path/to/socket' to
// establish a connection, while PECL Memcached requires only
// '/path/to/socket' string for the same purpose.
$pecl_extension = self::getPeclExtension();
$host = $pecl_extension == 'Memcached' ? substr($memcached_server, 7) : $memcached_server;
// For unix sockets port is always 0.
$port = 0;
}
return [
$host,
$port,
];
}