Browse files

Backporting changes made to Memcache in 2.0 to address issues with pe…

…rsistent

connections.  Refs #1705
  • Loading branch information...
1 parent f65cf55 commit b6ef1305dfcdc957171b5c7fe751d96c90a2127b @markstory markstory committed May 14, 2011
View
1 app/config/core.php
@@ -297,6 +297,7 @@
* '127.0.0.1:11211' // localhost, default port 11211
* ), //[optional]
* 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
+ * 'persistent' => true, // [optional] set this to false for non-persistent connections
* ));
*
*/
View
1 cake/console/templates/skel/config/core.php
@@ -297,6 +297,7 @@
* '127.0.0.1:11211' // localhost, default port 11211
* ), //[optional]
* 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
+ * 'persistent' => true, // [optional] set this to false for non-persistent connections
* ));
*
*/
View
5 cake/libs/cache/memcache.php
@@ -67,7 +67,8 @@ function init($settings = array()) {
'engine'=> 'Memcache',
'prefix' => Inflector::slug(APP_DIR) . '_',
'servers' => array('127.0.0.1'),
- 'compress'=> false
+ 'compress'=> false,
+ 'persistent' => true
), $settings)
);
@@ -82,7 +83,7 @@ function init($settings = array()) {
$this->__Memcache =& new Memcache();
foreach ($this->settings['servers'] as $server) {
list($host, $port) = $this->_parseServerString($server);
- if ($this->__Memcache->addServer($host, $port)) {
+ if ($this->__Memcache->addServer($host, $port, $this->settings['persistent'])) {
$return = true;
}
}
View
3 cake/tests/cases/libs/cache/memcache.test.php
@@ -106,7 +106,8 @@ function testSettings() {
'probability' => 100,
'servers' => array('127.0.0.1'),
'compress' => false,
- 'engine' => 'Memcache'
+ 'engine' => 'Memcache',
+ 'persistent' => true,
);
$this->assertEqual($settings, $expecting);
}

0 comments on commit b6ef130

Please sign in to comment.