mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00: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:
parent
10f81ee79f
commit
559313eda6
1 changed files with 10 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue