|
|
@@ -146,21 +146,16 @@ class MemcachedEngine extends CacheEngine
|
|
|
$this->_setOptions();
|
|
|
|
|
|
$serverList = $this->_Memcached->getServerList();
|
|
|
- if (count($serverList)) {
|
|
|
+ if ($serverList) {
|
|
|
if ($this->_config['persistent'] !== false) {
|
|
|
- $actualServers = [];
|
|
|
foreach ($serverList as $server) {
|
|
|
- $actualServers[] = $server['host'] . ':' . $server['port'];
|
|
|
- }
|
|
|
- unset($server);
|
|
|
- sort($actualServers);
|
|
|
- $configuredServers = $this->_config['servers'];
|
|
|
- sort($configuredServers);
|
|
|
- if ($actualServers !== $configuredServers) {
|
|
|
- $message = 'Invalid cache configuration. Multiple persistent cache configurations are detected' .
|
|
|
- ' with different `servers` values. `servers` values for persistent cache configurations' .
|
|
|
- ' must be the same when using the same persistence id.';
|
|
|
- throw new InvalidArgumentException($message);
|
|
|
+ if (!in_array($server['host'] . ':' . $server['port'], $this->_config['server'], true)) {
|
|
|
+ throw new InvalidArgumentException(
|
|
|
+ 'Invalid cache configuration. Multiple persistent cache configurations are detected' .
|
|
|
+ ' with different `servers` values. `servers` values for persistent cache configurations' .
|
|
|
+ ' must be the same when using the same persistence id.'
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|