mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-28 12:30:42 +02:00
[feature/memcache-multi-server] Adding support for multiple memcache servers to acm_memcache.php
You can define multiple memcache servers in your config using this format: host::port,host::port,host::port Example: @define(PHPBB_ACM_MEMCACHE, '127.0.0.1::11211,10.0.0.2::11211,memcache1::11211'
This commit is contained in:
@@ -37,6 +37,11 @@ if (!defined('PHPBB_ACM_MEMCACHE_HOST'))
|
||||
define('PHPBB_ACM_MEMCACHE_HOST', 'localhost');
|
||||
}
|
||||
|
||||
if (!defined('PHPBB_ACM_MEMCACHE')){
|
||||
//can define multiple servers with host1::port1,host2::port2 format
|
||||
define('PHPBB_ACM_MEMCACHE', PHPBB_ACM_MEMCACHE_HOST . '::' . PHPBB_ACM_MEMCACHE_PORT);
|
||||
}
|
||||
|
||||
/**
|
||||
* ACM for Memcached
|
||||
* @package acm
|
||||
@@ -54,7 +59,10 @@ class acm extends acm_memory
|
||||
parent::acm_memory();
|
||||
|
||||
$this->memcache = new Memcache;
|
||||
$this->memcache->connect(PHPBB_ACM_MEMCACHE_HOST, PHPBB_ACM_MEMCACHE_PORT);
|
||||
foreach(explode(',', PHPBB_ACM_MEMCACHE) as $u){
|
||||
$parts = explode('::', $u);
|
||||
$this->memcache->addServer($parts[0], $parts[1]);
|
||||
}
|
||||
$this->flags = (PHPBB_ACM_MEMCACHE_COMPRESS) ? MEMCACHE_COMPRESSED : 0;
|
||||
}
|
||||
|
||||
@@ -125,4 +133,4 @@ class acm extends acm_memory
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
Reference in New Issue
Block a user