You are here

protected function MemcacheConnection::connect in Memcache API and Integration 8.2

Connects to a memcache server.

Parameters

string $host: The server path without port.

int $port: The server port.

bool $persistent: Whether this server connection is persistent or not.

Return value

\Memcache|bool A Memcache object for a successful persistent connection. TRUE for a successful non-persistent connection. FALSE when the server fails to connect.

1 call to MemcacheConnection::connect()
MemcacheConnection::addServer in src/Connection/MemcacheConnection.php
Adds a memcache server.

File

src/Connection/MemcacheConnection.php, line 72

Class

MemcacheConnection
Class MemcacheConnection.

Namespace

Drupal\memcache\Connection

Code

protected function connect($host, $port, $persistent) {
  if ($persistent) {
    return @$this->memcache
      ->pconnect($host, $port);
  }
  else {
    return @$this->memcache
      ->connect($host, $port);
  }
}