You are here

public static function Redis_Client::getClient in Redis 7

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

Get client singleton.

16 calls to Redis_Client::getClient()
Redis_Cache_PhpRedis::clear in lib/Redis/Cache/PhpRedis.php
Expires data from the cache.
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.
Redis_Cache_PhpRedis::set in lib/Redis/Cache/PhpRedis.php
Stores data in the persistent cache.
Redis_Cache_Predis::clear in lib/Redis/Cache/Predis.php
Expires data from the cache.

... See full list

File

lib/Redis/Client.php, line 91

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_cache_host']) ? $conf['redis_client_host'] : self::REDIS_DEFAULT_HOST, isset($conf['redis_cache_port']) ? $conf['redis_client_port'] : self::REDIS_DEFAULT_PORT, isset($conf['redis_cache_base']) ? $conf['redis_client_base'] : self::REDIS_DEFAULT_BASE);
  }
  return self::$_client;
}