// or a single-process script which is switching
// configurations.
$persist = php_sapi_name() != 'cli' || self::$cacheInitialized;
- if (is_array($servers)) {
- foreach($servers as $server) {
- self::$cache->addServer($server, 11211, $persist);
+ if (!is_array($servers)) {
+ $servers = array($servers);
+ }
+ foreach($servers as $server) {
+ $parts = explode(':', $server);
+ $server = $parts[0];
+ if (count($parts) > 1) {
+ $port = $parts[1];
+ } else {
+ $port = 11211;
}
- } else {
- self::$cache->addServer($servers, 11211, $persist);
+ self::$cache->addServer($server, $port, $persist);
}
self::$cacheInitialized = true;
}