mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Backporting changes made to Memcache in 2.0 to address issues with persistent
connections. Refs #1705
This commit is contained in:
parent
f65cf55f4f
commit
b6ef1305df
4 changed files with 7 additions and 3 deletions
|
@ -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
|
||||
* ));
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
* ));
|
||||
*
|
||||
*/
|
||||
|
|
5
cake/libs/cache/memcache.php
vendored
5
cake/libs/cache/memcache.php
vendored
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue