]> git.mjollnir.org Git - moodle.git/commitdiff
init_memcached(): only use pconnect if configured to do so
authormartinlanghoff <martinlanghoff>
Wed, 27 Dec 2006 22:45:13 +0000 (22:45 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 27 Dec 2006 22:45:13 +0000 (22:45 +0000)
Make pconnections optional - only use pconnect if $CFG->memcachedpconn is
set. In current versions of the memcache client in PECL (v2.0.1),
memcache_pconnect() is buggy and will segfault if reusing a pconnection
to a server that has gone away or restarted.

And hope for a more stable client library in PECL ;-)

lib/setuplib.php

index d8e19a3bb1345416faeda5462a16c5cda5075326..2fe294a30a6611be0f8a31a688708069e256744a 100644 (file)
@@ -219,9 +219,11 @@ function init_memcached() {
                                                
     $hosts = split(',', $CFG->memcachedhosts);
     $MCACHE = new Memcache;
-    if (count($hosts) === 1) {
+    if (count($hosts) === 1 && !empty($CFG->memcachedpconn)) {
         // the faster pconnect is only available
         // for single-server setups
+        // NOTE: PHP-PECL client is buggy and pconnect() 
+        // will segfault if the server is unavailable
         $MCACHE->pconnect($hosts[0]);
     } else {
         // multi-host setup will share key space