Skip to content

Commit

Permalink
Backporting changes made to Memcache in 2.0 to address issues with pe…
Browse files Browse the repository at this point in the history
…rsistent

connections.  Refs #1705
  • Loading branch information
markstory committed May 14, 2011
1 parent f65cf55 commit b6ef130
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/config/core.php
Expand Up @@ -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
* ));
*
*/
Expand Down
1 change: 1 addition & 0 deletions cake/console/templates/skel/config/core.php
Expand Up @@ -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
* ));
*
*/
Expand Down
5 changes: 3 additions & 2 deletions cake/libs/cache/memcache.php
Expand Up @@ -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)
);

Expand All @@ -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;
}
}
Expand Down
3 changes: 2 additions & 1 deletion cake/tests/cases/libs/cache/memcache.test.php
Expand Up @@ -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);
}
Expand Down

0 comments on commit b6ef130

Please sign in to comment.