__construct() public method

public __construct ( mixed $parameters = null, mixed $options = null )
$parameters mixed Connection parameters for one or more servers.
$options mixed Options to configure some behaviours of the client.
Example #1
0
 /**
  * PRedis constructor.
  *
  * @param array $conf
  * @param $options
  */
 public function __construct($conf = [], $options = null)
 {
     if (!$conf) {
         $conf = \Flight::get('config')->get('redis');
     }
     parent::__construct($conf, $options);
 }
Example #2
0
 function __construct($parameters = null, $options = null, ConnectionFactory $factory = null)
 {
     if (empty($parameters['password'])) {
         unset($parameters['password']);
     }
     if (!empty($factory)) {
         $options['connections'] = $factory;
     }
     parent::__construct($parameters, $options);
 }
Example #3
0
 /**
  * @param Server $server The server to use
  * @param TypeMapper $typeMapper The type mapper to use
  */
 public function __construct(Server $server, TypeMapper $typeMapper)
 {
     $this->server = $server;
     $this->typeMapper = $typeMapper;
     $connectionOptions = ["host" => $this->server->getHost(), "port" => $this->server->getPort(), "database" => $this->server->getDatabaseIndex()];
     if ($this->server->passwordIsSet()) {
         $connectionOptions["password"] = $this->server->getPassword();
     }
     if ($this->server->getConnectionTimeout() > 0) {
         $connectionOptions["connection_timeout"] = $this->server->getConnectionTimeout();
     }
     parent::__construct($connectionOptions);
 }
Example #4
0
 /**
  * @param mixed $parameters Connection parameters for one or more servers.
  * @param mixed $options    Options to configure some behaviours of the client.
  */
 public function __construct($parameters = null, $options = null)
 {
     parent::__construct($parameters, $options);
     /** @var \Predis\Profile\RedisProfile $profile */
     $profile = $this->getProfile();
     $profile->defineCommand('queueGet', 'PhpRQ\\Command\\Queue\\Get');
     $profile->defineCommand('queueAck', 'PhpRQ\\Command\\Queue\\Ack');
     $profile->defineCommand('queueReject', 'PhpRQ\\Command\\Queue\\Reject');
     $profile->defineCommand('queueReEnqueue', 'PhpRQ\\Command\\Queue\\ReEnqueue');
     $profile->defineCommand('uniqueQueueAdd', 'PhpRQ\\Command\\UniqueQueue\\Add');
     $profile->defineCommand('uniqueQueueGet', 'PhpRQ\\Command\\UniqueQueue\\Get');
     $profile->defineCommand('uniqueQueueAck', 'PhpRQ\\Command\\UniqueQueue\\Ack');
     $profile->defineCommand('uniqueQueueReject', 'PhpRQ\\Command\\UniqueQueue\\Reject');
     $profile->defineCommand('uniqueQueueReEnqueue', 'PhpRQ\\Command\\UniqueQueue\\ReEnqueue');
     $profile->defineCommand('poolGet', 'PhpRQ\\Command\\Pool\\Get');
     $profile->defineCommand('poolAck', 'PhpRQ\\Command\\Pool\\Ack');
     $profile->defineCommand('poolRemove', 'PhpRQ\\Command\\Pool\\Remove');
     $profile->defineCommand('wait', 'PhpRQ\\Command\\Wait');
 }
 /**
  * @param null $parameters
  * @param null $options
  */
 public function __construct($parameters = null, $options = null)
 {
     unset($options['prefix']);
     parent::__construct($parameters, $options);
 }
Example #6
0
 public function __construct($host = '127.0.0.1', $port = 6379)
 {
     parent::__construct(['scheme' => 'tcp', 'host' => $host, 'port' => $port]);
 }
Example #7
0
 public function __construct($host, $password, $port)
 {
     parent::__construct(['scheme' => 'tcp', 'host' => $host, 'password' => $password, 'port' => $port]);
 }
Example #8
0
 /**
  * RedisApi constructor.
  * set all options and add prefix processor to make prefix customizable
  *
  * @param array|string $host
  * @param integer $port
  * @param integer $timeout
  * @param null|string $password
  */
 public function __construct($host, $port = 6379, $timeout = 5, $password = null)
 {
     $options = ['port' => $port, 'database' => 0, 'timeout' => $timeout, 'password' => $password];
     if (is_array($host)) {
         $options['cluster'] = 'redis';
     }
     parent::__construct($host, $options);
     $this->prefix = new KeyPrefixProcessor(self::$namespace);
     $this->getProfile()->setProcessor($this->prefix);
 }