laravel-websockets/tests/Mocks/RedisFactory.php

40 lines
880 B
PHP
Raw Normal View History

2020-08-14 12:35:36 +00:00
<?php
namespace BeyondCode\LaravelWebSockets\Tests\Mocks;
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);
}
}