concrete/src/Session/SessionFactory.php
private function newMemcachedServers(Memcached $memcached, array $servers)
    {
        $serverIndex = [];
        $existingServers = $memcached->getServerList();

        foreach ($existingServers as $server) {
            $serverIndex[$server['host'] . ':' . $server['port']] = true;
        }

        foreach ($servers as $configServer) {
            $server = [
                'host' => array_get($configServer, 'host', ''),
                'port' => array_get($configServer, 'port', 11211),
                'weight' => array_get($configServer, 'weight', 0),
            ];

            if (!isset($serverIndex[$server['host'] . ':' . $server['port']])) {
                yield $server;
            }
        }
    }
private function newMemcachedServers(Memcached $memcached, array $servers)
    {
        $serverIndex = [];
        $existingServers = $memcached->getServerList();

        foreach ($existingServers as $server) {
            $serverIndex[$server['host'] . ':' . $server['port']] = true;
        }

        foreach ($servers as $configServer) {
            $server = [
                'host' => array_get($configServer, 'host', ''),
                'port' => array_get($configServer, 'port', 11211),
                'weight' => array_get($configServer, 'weight', 0),
            ];

            if (!isset($serverIndex[$server['host'] . ':' . $server['port']])) {
                yield $server;
            }
        }
    }
private function newMemcachedServers ( Memcached $ memcached , array $ servers ) { $ serverIndex = [ ] ; $ existingServers = $ memcached -> getServerList ( ) ; foreach ( $ existingServers as $ server ) { $ serverIndex [ $ server [ 'host' ] . ':' . $ server [ 'port' ] ] = true ; } foreach ( $ servers as $ configServer ) { $ server = [ 'host' => array_get ( $ configServer , 'host' , '' ) , 'port' => array_get ( $ configServer , 'port' , 11211 ) , 'weight' => array_get ( $ configServer , 'weight' , 0 ) , ] ; if ( ! isset ( $ serverIndex [ $ server [ 'host' ] . ':' . $ server [ 'port' ] ] ) ) { yield $ server ; } } }
Generator for only returning hosts that aren't already added to the memcache instance.

@param \Memcached $memcached
@param array $servers The servers as described in config

@return \Generator|string[] [ $host, $port, $weight ]
Generator for only returning hosts that aren t already added to the memcache instance .