mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Added 'persistent' setting to MemcacheEngine.
Fixes #1705 when connections are not closed when using i.e. FCGI.
This commit is contained in:
parent
228230e67b
commit
402c4a7a6f
3 changed files with 5 additions and 2 deletions
|
@ -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 (i.e. when using fcgi)
|
||||
* 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
|
||||
* ));
|
||||
*
|
||||
|
|
|
@ -64,6 +64,7 @@ class MemcacheEngine extends CacheEngine {
|
|||
'engine'=> 'Memcache',
|
||||
'prefix' => Inflector::slug(APP_DIR) . '_',
|
||||
'servers' => array('127.0.0.1'),
|
||||
'persistent' => true,
|
||||
'compress'=> false
|
||||
), $settings)
|
||||
);
|
||||
|
@ -79,7 +80,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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
@ -86,6 +86,7 @@ class MemcacheEngineTest extends CakeTestCase {
|
|||
'duration'=> 3600,
|
||||
'probability' => 100,
|
||||
'servers' => array('127.0.0.1'),
|
||||
'persistent' => true,
|
||||
'compress' => false,
|
||||
'engine' => 'Memcache'
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue