You are here

public static function Redis_Client::getClientInterface in Redis 7

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

Lazy instanciate client proxy depending on the actual configuration.

If you are using a lock, session or cache backend using one of the Redis client implementation, this will be overrided at early bootstrap phase and configuration will be ignored.

Return value

Redis_Client_Interface

File

lib/Redis/Client.php, line 62

Class

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

Code

public static function getClientInterface() {
  if (!isset(self::$_clientInterface)) {
    global $conf;
    if (isset($conf['redis_client_interface']) && class_exists($conf['redis_client_interface'])) {
      self::$_clientInterface = new $conf['redis_client_interface']();
    }
    else {
      if (!isset(self::$_clientInterface)) {
        throw new Exception("No client interface set.");
      }
    }
  }
  return self::$_clientInterface;
}