2020-08-14 12:35:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
2025-01-16 07:54:02 +00:00
|
|
|
namespace BlaxSoftware\LaravelWebSockets\Test\Mocks;
|
2020-08-14 12:35:36 +00:00
|
|
|
|
|
|
|
|
use Clue\React\Redis\Factory;
|
2020-08-14 12:36:00 +00:00
|
|
|
use Clue\Redis\Protocol\Factory as ProtocolFactory;
|
2020-08-14 12:35:36 +00:00
|
|
|
use React\EventLoop\LoopInterface;
|
|
|
|
|
use React\Socket\ConnectorInterface;
|
|
|
|
|
|
|
|
|
|
class RedisFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The loop instance.
|
|
|
|
|
*
|
|
|
|
|
* @var LoopInterface
|
|
|
|
|
*/
|
|
|
|
|
private $loop;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
|
|
|
|
public function __construct(LoopInterface $loop, ConnectorInterface $connector = null, ProtocolFactory $protocol = null)
|
|
|
|
|
{
|
|
|
|
|
parent::__construct($loop, $connector, $protocol);
|
|
|
|
|
|
|
|
|
|
$this->loop = $loop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2020-08-14 12:36:00 +00:00
|
|
|
* Create Redis client connected to address of given redis instance.
|
2020-08-14 12:35:36 +00:00
|
|
|
*
|
|
|
|
|
* @param string $target
|
|
|
|
|
* @return Client
|
|
|
|
|
*/
|
|
|
|
|
public function createLazyClient($target)
|
|
|
|
|
{
|
|
|
|
|
return new LazyClient($target, $this, $this->loop);
|
|
|
|
|
}
|
|
|
|
|
}
|