You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ch...@apache.org on 2009/03/16 14:37:58 UTC

svn commit: r754888 - in /incubator/shindig/trunk/php: config/container.php src/common/sample/CacheStorageMemcache.php

Author: chabotc
Date: Mon Mar 16 13:37:57 2009
New Revision: 754888

URL: http://svn.apache.org/viewvc?rev=754888&view=rev
Log:
SHINDIG-973 by Nagy Attila: Making memcache pconnect optional (adapted for trunk)

Modified:
    incubator/shindig/trunk/php/config/container.php
    incubator/shindig/trunk/php/src/common/sample/CacheStorageMemcache.php

Modified: incubator/shindig/trunk/php/config/container.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/config/container.php?rev=754888&r1=754887&r2=754888&view=diff
==============================================================================
--- incubator/shindig/trunk/php/config/container.php (original)
+++ incubator/shindig/trunk/php/config/container.php Mon Mar 16 13:37:57 2009
@@ -137,9 +137,11 @@
   'userpref_param_prefix' => 'up_',
   'libs_param_name' => 'libs',
 
-  // If you use CacheMemcache as caching backend, change these to the memcache server settings
+  // If you use CacheStorageMemcache as caching backend, change these to the memcache server settings
   'cache_host' => 'localhost',
   'cache_port' => 11211,
+  // When using CacheStorageMemcache, should we use pconnect? There are some reports that apache/mpm + memcache_pconnect can lead to segfaults
+  'cache_memcache_pconnect' => true,
   'cache_time' => 24 * 60 * 60,
   // If you use CacheStorageFile as caching backend, this is the directory where it stores the temporary files
   'cache_root' => '/tmp/shindig',

Modified: incubator/shindig/trunk/php/src/common/sample/CacheStorageMemcache.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/sample/CacheStorageMemcache.php?rev=754888&r1=754887&r2=754888&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/sample/CacheStorageMemcache.php (original)
+++ incubator/shindig/trunk/php/src/common/sample/CacheStorageMemcache.php Mon Mar 16 13:37:57 2009
@@ -32,8 +32,14 @@
       self::$memcache = new Memcache();
       $host = Config::get('cache_host');
       $port = Config::get('cache_port');
-      if (!self::$memcache->pconnect($host, $port)) {
-        throw new CacheException("Couldn't connect to memcache server");
+      if (Config::get('cache_memcache_pconnect')) {
+        if (!self::$memcache->pconnect($host, $port)) {
+          throw new CacheException("Couldn't connect to memcache server");
+        }
+      } else {
+        if (!self::$memcache->connect($host, $port)) {
+          throw new CacheException("Couldn't connect to memcache server");
+        }
       }
     }
   }