本文整理汇总了PHP中Predis\Client::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::__construct方法的具体用法?PHP Client::__construct怎么用?PHP Client::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predis\Client
的用法示例。
在下文中一共展示了Client::__construct方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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);
}
示例2: unset
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);
}
示例3: __construct
/**
* @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);
}
示例4: __construct
/**
* @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');
}
示例5: __construct
/**
* @param null $parameters
* @param null $options
*/
public function __construct($parameters = null, $options = null)
{
unset($options['prefix']);
parent::__construct($parameters, $options);
}
示例6: __construct
public function __construct($host = '127.0.0.1', $port = 6379)
{
parent::__construct(['scheme' => 'tcp', 'host' => $host, 'port' => $port]);
}
示例7: __construct
public function __construct($host, $password, $port)
{
parent::__construct(['scheme' => 'tcp', 'host' => $host, 'password' => $password, 'port' => $port]);
}
示例8: __construct
/**
* 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);
}