You are here

class Redis_Client_PhpRedis in Redis 7.3

Same name and namespace in other branches
  1. 7 lib/Redis/Client/PhpRedis.php \Redis_Client_PhpRedis
  2. 7.2 lib/Redis/Client/PhpRedis.php \Redis_Client_PhpRedis

PhpRedis client specific implementation.

Hierarchy

Expanded class hierarchy of Redis_Client_PhpRedis

File

lib/Redis/Client/PhpRedis.php, line 6

View source
class Redis_Client_PhpRedis implements Redis_Client_FactoryInterface {
  public function getClient($options = array()) {
    $client = new Redis();
    if (!empty($options['socket'])) {
      $client
        ->connect($options['socket']);
    }
    else {
      $client
        ->connect($options['host'], $options['port']);
    }
    if (isset($options['password'])) {
      $client
        ->auth($options['password']);
    }
    if (isset($options['base'])) {
      $client
        ->select($options['base']);
    }

    // Do not allow PhpRedis serialize itself data, we are going to do it
    // ourself. This will ensure less memory footprint on Redis size when
    // we will attempt to store small values.
    $client
      ->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);
    return $client;
  }
  public function getName() {
    return 'PhpRedis';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Redis_Client_PhpRedis::getClient public function Get the connected client instance. Overrides Redis_Client_FactoryInterface::getClient
Redis_Client_PhpRedis::getName public function Get underlaying library name used. Overrides Redis_Client_FactoryInterface::getName