summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2008-09-26 15:55:01 -0400
committerEvan Prodromou <evan@controlyourself.ca>2008-09-26 15:55:01 -0400
commit15c0fb7abd2a364886729d416231cac8ae0ef004 (patch)
tree1b54323701404ed0255b8f8c215ea75a47823766
parent4af31ca98a0a09a59504f6217d6022ebf59afca3 (diff)
handle multiple memcached servers
darcs-hash:20080926195501-5ed1f-b811fac3320a0b6d8002771caa9463ba9a0889a1.gz
-rw-r--r--classes/Memcached_DataObject.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php
index e3e7d0440..7ca2c7db2 100644
--- a/classes/Memcached_DataObject.php
+++ b/classes/Memcached_DataObject.php
@@ -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;
}
}