src/Memcache.php
static public function connect(
		\Memcache $Memcache, $host, $port = 11211, $persistent = true){

		$host = (string) $host;
		$port = (int) $port;

		if($persistent){

			$result = @$Memcache->pconnect($host, $port);
		}
		else{

			$result = @$Memcache->connect($host, $port);
		}

		if($result && self::COMPRESS_THRESHOLD > 0){

			/** @noinspection PhpVoidFunctionResultUsedInspection */
			/** @noinspection PhpUnusedLocalVariableInspection */
			$compress = @$Memcache->setcompressthreshold(
				self::COMPRESS_THRESHOLD, self::COMPRESS_SAVINGS);

			assert('$compress !== false');
		}

		return $result;
	}
static public function connect(
		\Memcache $Memcache, $host, $port = 11211, $persistent = true){

		$host = (string) $host;
		$port = (int) $port;

		if($persistent){

			$result = @$Memcache->pconnect($host, $port);
		}
		else{

			$result = @$Memcache->connect($host, $port);
		}

		if($result && self::COMPRESS_THRESHOLD > 0){

			/** @noinspection PhpVoidFunctionResultUsedInspection */
			/** @noinspection PhpUnusedLocalVariableInspection */
			$compress = @$Memcache->setcompressthreshold(
				self::COMPRESS_THRESHOLD, self::COMPRESS_SAVINGS);

			assert('$compress !== false');
		}

		return $result;
	}
static public function connect ( \ Memcache $ Memcache , $ host , $ port = 11211 , $ persistent = true ) { $ host = ( string ) $ host ; $ port = ( int ) $ port ; if ( $ persistent ) { $ result = @ $ Memcache -> pconnect ( $ host , $ port ) ; } else { $ result = @ $ Memcache -> connect ( $ host , $ port ) ; } if ( $ result && self :: COMPRESS_THRESHOLD > 0 ) { /** @noinspection PhpVoidFunctionResultUsedInspection */ /** @noinspection PhpUnusedLocalVariableInspection */ $ compress = @ $ Memcache -> setcompressthreshold ( self :: COMPRESS_THRESHOLD , self :: COMPRESS_SAVINGS ) ; assert ( '$compress !== false' ) ; } return $ result ; }
Connect a Memcache-instance.

<p>The connection-state of the provided {@link $Memcache}-instance is
<strong>not</strong> checked before attempting to connect it. So, passing
in an already connected instance is not recommended and will most likely
lead to unexpected results.</p>

@param \Memcache $Memcache
@param string $host
@param integer $port
@param boolean $persistent
@return boolean
Connect a Memcache - instance .