Skip to content

Commit

Permalink
Merge remote-tracking branch 'tploch/2.0-memcache' into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 14, 2011
2 parents a6f507d + 4aa9254 commit 23d9e5d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/config/core.php
Expand Up @@ -279,6 +279,7 @@
* 'servers' => array(
* '127.0.0.1:11211' // localhost, default port 11211
* ), //[optional]
* 'persistent' => true, // [optional] set this to false for non-persistent connections
* 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
* ));
*
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/Cache/Engine/MemcacheEngine.php
Expand Up @@ -64,6 +64,7 @@ public function init($settings = array()) {
'engine'=> 'Memcache',
'prefix' => Inflector::slug(APP_DIR) . '_',
'servers' => array('127.0.0.1'),
'persistent' => true,
'compress'=> false
), $settings)
);
Expand All @@ -79,7 +80,7 @@ public 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
1 change: 1 addition & 0 deletions lib/Cake/Console/templates/skel/config/core.php
Expand Up @@ -279,6 +279,7 @@
* 'servers' => array(
* '127.0.0.1:11211' // localhost, default port 11211
* ), //[optional]
* 'persistent' => true, // [optional] set this to false for non-persistent connections
* 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
* ));
*
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/tests/Case/Cache/Engine/MemcacheTest.php
Expand Up @@ -50,7 +50,7 @@ class MemcacheEngineTest extends CakeTestCase {
* @return void
*/
function setUp() {
$this->skipIf(!class_exists('Memcache'), '%s Apc is not installed or configured properly');
$this->skipIf(!class_exists('Memcache'), '%s Memcache is not installed or configured properly');
$this->_cacheDisable = Configure::read('Cache.disable');
Configure::write('Cache.disable', false);
Cache::config('memcache', array(
Expand Down Expand Up @@ -86,6 +86,7 @@ function testSettings() {
'duration'=> 3600,
'probability' => 100,
'servers' => array('127.0.0.1'),
'persistent' => true,
'compress' => false,
'engine' => 'Memcache'
);
Expand Down

0 comments on commit 23d9e5d

Please sign in to comment.