handle multiple memcached servers

darcs-hash:20080926195501-5ed1f-b811fac3320a0b6d8002771caa9463ba9a0889a1.gz
This commit is contained in:
Evan Prodromou 2008-09-26 15:55:01 -04:00
parent 4af31ca98a
commit 15c0fb7abd

View File

@ -73,9 +73,15 @@ class Memcached_DataObject extends DB_DataObject
return NULL;
} else {
$cache = new Memcache();
$res = $cache->connect(common_config('memcached', 'server'),
common_config('memcached', 'port'));
return ($res) ? $cache : NULL;
$servers = common_config('memcached', 'server');
if (is_array($servers)) {
foreach($servers as $server) {
$cache->addServer($server);
}
} else {
$cache->addServer($servers);
}
return $cache;
}
}