You are here

public static function Redis_Client::getClient in Redis 7.2

Same name and namespace in other branches
  1. 7.3 lib/Redis/Client.php \Redis_Client::getClient()
  2. 7 lib/Redis/Client.php \Redis_Client::getClient()

Get client singleton.

27 calls to Redis_Client::getClient()
Redis_AbstractBackend::getClient in lib/Redis/AbstractBackend.php
Get redis client
Redis_Cache_PhpRedis::clearWithEval in lib/Redis/Cache/PhpRedis.php
Redis_Cache_PhpRedis::clearWithoutEval in lib/Redis/Cache/PhpRedis.php
Redis_Cache_PhpRedis::get in lib/Redis/Cache/PhpRedis.php
Returns data from the persistent cache.
Redis_Cache_PhpRedis::getMultiple in lib/Redis/Cache/PhpRedis.php
Returns data from the persistent cache when given an array of cache IDs.

... See full list

File

lib/Redis/Client.php, line 152

Class

Redis_Client
Common code and client singleton, for all Redis clients.

Code

public static function getClient() {
  if (!isset(self::$_client)) {
    global $conf;

    // Always prefer socket connection.
    self::$_client = self::getClientInterface()
      ->getClient(isset($conf['redis_client_host']) ? $conf['redis_client_host'] : self::REDIS_DEFAULT_HOST, isset($conf['redis_client_port']) ? $conf['redis_client_port'] : self::REDIS_DEFAULT_PORT, isset($conf['redis_client_base']) ? $conf['redis_client_base'] : self::REDIS_DEFAULT_BASE, isset($conf['redis_client_password']) ? $conf['redis_client_password'] : self::REDIS_DEFAULT_PASSWORD, isset($conf['redis_client_socket']) ? $conf['redis_client_socket'] : self::REDIS_DEFAULT_SOCKET);
  }
  return self::$_client;
}