load and merge connection options from optional Memcached cache into
ihe current settings

@return void
492201
private function loadOptionsFromCache() 
    {
        $cache = $this->getEndpointsCache();

        if ($cache === null) {
            return;
        }
        
        $endpoints = $cache->get($this->_values[self::OPTION_MEMCACHED_ENDPOINTS_KEY]);
        if ($endpoints) {
            $this->_values[self::OPTION_ENDPOINT] = $endpoints;
            if (!is_array($this->_values[self::OPTION_ENDPOINT])) {
                $this->_values[self::OPTION_ENDPOINT] = [ $this->_values[self::OPTION_ENDPOINT] ];
            }
        }
    }
1285569
public function cacheFixtures()
    {
        $this->init();

        $this->migrations = $this->fetchMigrations();
        $this->fixtures   = $this->fetchFixtures();

        if ($this->useBackup && ! $this->hasBackup()) {
            $this->dropDatabase();
        }
    }
705991
public static function connect() {
		if (self::$memcache === null) {
			$config = \Skeleton\Object\Config::$cache_handler_config;
			self::$memcache = new \Memcache();
			self::$memcache->connect($config['hostname'], $config['port']);
		}

		return self::$memcache;
	}
465802
private function _connect() 
    {

        if ($this->config['host'] && $this->config['port']) {
            // establish the memcache connection
            $this->memcache = new Memcache;
            $this->memcache->pconnect(
            	$this->config['host'], 
                $this->config['port']
            );

        } else {
            throw new Exception('Insufficient connection parameters');
        }
    }
775631
protected static function _initializeCache()
    {
        if ( !static::$_options[CoreSettings::ENABLE_CACHE] )
        {
            return false;
        }

        //  Try memcached
        try
        {
            return static::$_cache = Flexistore::createMemcachedStore( array('host' => 'localhost') );
        }
        catch ( \Exception $_ex )
        {
        }

        //  Try memcache
        try
        {
            return static::$_cache = Flexistore::createMemcacheStore( array('host' => 'localhost') );
        }
        catch ( \Exception $_ex )
        {
        }

        //  Find me a cache path!
        if ( false === ( $_path = static::_getCachePath() ) )
        {
            return false;
        }

        //  Try files
        return static::$_cache = Flexistore::createFileStore( $_path );
    }
901095
final public function initialize()
    {
        $this->_ensureModuleExistence();
        $this->memcache = new Memcache();
        // support multiple hosts using semicolon to separate hosts
        $hosts = explode(";", $this->host);
        // different ports for each hosts the same way
        $ports = explode(";", $this->port);
        if (count($hosts) > 1) {
            if (count($ports) < 1) {
                $ports = array_fill(0, count($hosts), self::DEFAULT_PORT);
            } elseif (count($ports) == 1) {
                // if we have just one port, use it for all hosts
                $_p = $ports[0];
                $ports = array_fill(0, count($hosts), $_p);
            }
            foreach ($hosts as $i => $host) {
                $this->memcache->addServer($host, $ports[$i]);
            }
        } else {
            // just connect to the single host
            $this->memcache->connect($hosts[0], $ports[0]);
        }
    }
1169942
private function storeOptionsInCache() 
    {
        $endpoints = $this->_values[self::OPTION_ENDPOINT];
        $numberOfEndpoints = count($endpoints);

        if ($numberOfEndpoints <= 1) {
            return;
        }

        // now try to store the updated values in the cache
        $cache = $this->getEndpointsCache();
        if ($cache === null) {
            return;
        }
        
        $update = [ $endpoints[$this->_currentEndpointIndex] ];
        for ($i = 0; $i < $numberOfEndpoints; ++$i) {
            if ($i !== $this->_currentEndpointIndex) {
                $update[] = $endpoints[$i];
            }
        }

        $ttl = (int) $this->_values[self::OPTION_MEMCACHED_TTL];
        $cache->set($this->_values[self::OPTION_MEMCACHED_ENDPOINTS_KEY], $update, $ttl);
      }
97108
private function initializeMemCached()
    {
        $this->memcached = new \Memcached();

        // support multiple hosts using semicolon to separate hosts
        $hosts = explode(';', $this->host);

        // different ports for each hosts the same way
        $ports = explode(';', $this->port);

        if (count($ports) < 1) {
            $ports = array_fill(0, count($hosts), self::DEFAULT_PORT);
        } elseif (count($ports) === 1) {
            // if we have just one port, use it for all hosts
            $usedPort = $ports[0];
            $ports    = array_fill(0, count($hosts), $usedPort);
        }

        foreach ($hosts as $i => $host) {
            if (!isset($ports[$i])) {
                /*
                 * if we have a difference between the count of hosts and
                 * the count of ports, use the default port to fill the gap
                 */
                $ports[$i] = self::DEFAULT_PORT;
            }

            $this->memcached->addServer($host, $ports[$i]);
        }
    }
228919
protected function _setOptions()
    {
        $this->_Memcached->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);

        $serializer = strtolower($this->_config['serialize']);
        if (!isset($this->_serializers[$serializer])) {
            throw new InvalidArgumentException(
                sprintf('%s is not a valid serializer engine for Memcached', $serializer)
            );
        }

        if ($serializer !== 'php' &&
            !constant('Memcached::HAVE_' . strtoupper($serializer))
        ) {
            throw new InvalidArgumentException(
                sprintf('Memcached extension is not compiled with %s support', $serializer)
            );
        }

        $this->_Memcached->setOption(
            Memcached::OPT_SERIALIZER,
            $this->_serializers[$serializer]
        );

        // Check for Amazon ElastiCache instance
        if (defined('Memcached::OPT_CLIENT_MODE') &&
            defined('Memcached::DYNAMIC_CLIENT_MODE')
        ) {
            $this->_Memcached->setOption(
                Memcached::OPT_CLIENT_MODE,
                Memcached::DYNAMIC_CLIENT_MODE
            );
        }

        $this->_Memcached->setOption(
            Memcached::OPT_COMPRESSION,
            (bool)$this->_config['compress']
        );
    }
836972
public function setConnection(\Memcached $memcached)
    {
        $this->connection = $memcached;

        if (!count($this->connection->getServerList())) {
            $this->configureServers();
        }

        $this->setOptions();
        return $this;
    }
1088977
private function _connected() {

        // if there's no connection to a MySQL database
        if (!$this->connection) {

            // we need this because it is the only way we can set the connection options (if any)
            $this->connection = mysqli_init();

            // if we have any options set
            if (!empty($this->options))

                // iterate over the set options
                foreach ($this->options as $option => $value)

                    // set each option
                    $this->connection->options($option, $value) ||

                        // log if there's a bogus option/value
                        $this->_log('errors', array(

                            'message'   => sprintf($this->language['invalid_option'], $option),

                        ));

            // connect to the MySQL server
            @mysqli_real_connect(
                $this->connection,
                $this->credentials['host'],
                $this->credentials['user'],
                $this->credentials['password'],
                $this->credentials['database'],
                $this->credentials['port'],
                $this->credentials['socket']
            );

            // tries to connect to the MySQL database
            if (mysqli_connect_errno())

                // if connection could not be established
                // save debug information
                return $this->_log('errors', array(

                    'message'   => $this->language['could_not_connect_to_database'],
                    'error'     => mysqli_connect_error(),

                ));

            // if caching is to be done to a memcache server and we don't yet have a connection
            if (!$this->memcache && $this->memcache_host !== false && $this->memcache_port !== false) {

                // if memcache extension is installed
                if (class_exists('Memcache')) {

                    // instance to the memcache object
                    $memcache = new Memcache();

                    // try to connect to the memcache server
                    if (!$memcache->connect($this->memcache_host, $this->memcache_port))

                        // if connection could not be established, save debug information
                        $this->_log('errors', array(

                            'message'   => $this->language['could_not_connect_to_memcache_server']

                        ));

                    else $this->memcache = $memcache;

                // if memcache extension is not installed
                } else

                    // if connection could not be established, save debug information
                    $this->_log('errors', array(

                        'message'   => $this->language['memcache_extension_not_installed']

                    ));

            }

        }

        // return TRUE if there is no error
        return true;

    }
40262
public static function 
    {

        if (self::$memcached) {
            return;
        }

        self::$memcached = new \Memcached();

        foreach (self::$config['memcached']['servers'] as $server) {
            extract(array_merge(self::$memcachedServerDefaults, $server));

            self::$memcached->addServers($host, $port, $persistent, $weight, $timeout);
        }
    }
122804
protected function loadAndCacheFaces(){

        $faces = $this->_loadFaces();
        foreach($faces as $face){
            $this->cacheFace($face);
            $this->addFace($face);
        }
    }
1289430
public function loadConfigurationCache(): bool
    {
        $cachePathAndFilename = $this->constructConfigurationCachePath();
        $configurations = @include $cachePathAndFilename;
        if ($configurations !== false) {
            $this->configurations = $configurations;
            return true;
        }

        return false;
    }
294087
public function loadConfiguration(): void
	{
		$builder = $this->getContainerBuilder();
		$config = $this->validateConfig($this->defaults);
		$config = Helpers::expand($config, $builder->parameters);

		$annotations = $builder->addDefinition($this->prefix('annotations'))
			->setType(AnnotationReader::class)
			->setAutowired(false);

		foreach ($config['ignore'] as $name) {
			$annotations->addSetup('addGlobalIgnoredName', [$name]);
		}

		$cache = $builder->addDefinition($this->prefix('cache'))
			->setAutowired(false);

		if ($config['cache'] === self::CACHE_AUTO) {
			if (extension_loaded('apcu')) {
				$cache->setType(ApcuCache::class);
			} else {
				$cache->setType(PhpFileCache::class)
					->setArguments([$config['temp']]);
			}
		} else {
			Compiler::loadDefinition($cache, $config['cache']);
		}

		$builder->addDefinition($this->prefix('reader'))
			->setType(Reader::class)
			->setFactory(CachedReader::class, [
				'@' . $this->prefix('annotations'),
				'@' . $this->prefix('cache'),
				$config['debug'],
			]);
	}
1137302
public function connection()
    {
        $db = ConnectionManager::get('default');
        foreach ($db->config() as $key => $value) {
            if (is_array($value)) {
                continue;
            }
            $this->out(sprintf('- %s: %s', $key, $value));
        }
    }
950814
private function initializeMemCache()
    {
        $this->memcache = new \Memcache();

        // support multiple hosts using semicolon to separate hosts
        $hosts = explode(';', $this->host);

        // different ports for each hosts the same way
        $ports = explode(';', $this->port);

        if (count($ports) < 1) {
            $ports = array_fill(0, count($hosts), self::DEFAULT_PORT);
        } elseif (count($ports) === 1) {
            // if we have just one port, use it for all hosts
            $usedPort = $ports[0];
            $ports    = array_fill(0, count($hosts), $usedPort);
        }

        foreach ($hosts as $i => $host) {
            if (!isset($ports[$i])) {
                /*
                 * if we have a difference between the count of hosts and
                 * the count of ports, use the default port to fill the gap
                 */
                $ports[$i] = self::DEFAULT_PORT;
            }

            $this->memcache->addServer($host, $ports[$i]);
        }
    }