Backporting changes made to Memcache in 2.0 to address issues with persistent

connections.  Refs #1705
This commit is contained in:
mark_story 2011-05-13 22:10:58 -04:00
parent f65cf55f4f
commit b6ef1305df
4 changed files with 7 additions and 3 deletions

View file

@ -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 file

@ -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 file

@ -67,7 +67,8 @@ class MemcacheEngine extends CacheEngine {
'engine'=> 'Memcache',
'prefix' => Inflector::slug(APP_DIR) . '_',
'servers' => array('127.0.0.1'),
'compress'=> false
'compress'=> false,
'persistent' => true
), $settings)
);
@ -82,7 +83,7 @@ class MemcacheEngine extends CacheEngine {
$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 file

@ -106,7 +106,8 @@ class MemcacheEngineTest extends CakeTestCase {
'probability' => 100,
'servers' => array('127.0.0.1'),
'compress' => false,
'engine' => 'Memcache'
'engine' => 'Memcache',
'persistent' => true,
);
$this->assertEqual($settings, $expecting);
}