]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
handle multiple memcached servers
authorEvan Prodromou <evan@controlyourself.ca>
Fri, 26 Sep 2008 19:55:01 +0000 (15:55 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Fri, 26 Sep 2008 19:55:01 +0000 (15:55 -0400)
darcs-hash:20080926195501-5ed1f-b811fac3320a0b6d8002771caa9463ba9a0889a1.gz

classes/Memcached_DataObject.php

index e3e7d0440f9a435b6770e4810e887605c66b0cc3..7ca2c7db210a774652fd172ce49cb1a3d8a914c8 100644 (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;
                }
        }