lithium\storage\cache\adapter\Memcache::_formatHostList()
Formats standard 'host:port'
strings into arrays used by Memcached
.
Parameters
-
mixed
$host
A host string in
'host:port'
format, or an array of host strings optionally paired with relative selection weight values.
Returns
arrayReturns an array of Memcached
server definitions.
Source
protected function _formatHostList($host) {
$hosts = [];
foreach ((array) $this->_config['host'] as $host => $weight) {
$host = HostString::parse(($hasWeight = is_integer($weight)) ? $host : $weight) + [
'host' => static::DEFAULT_HOST,
'port' => static::DEFAULT_PORT
];
$host = [$host['host'], $host['port']];
if ($hasWeight) {
$host[] = $weight;
}
$hosts[] = $host;
}
return $hosts;
}