| 1 | <?php declare(strict_types=1); |
||
| 12 | class Redis implements QueueInterface |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var Client |
||
| 16 | */ |
||
| 17 | protected $redis; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $key; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var int |
||
| 26 | */ |
||
| 27 | protected $length = 0; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Redis constructor. |
||
| 31 | * @param Client $redis |
||
| 32 | * @param string $key |
||
| 33 | */ |
||
| 34 | 1 | public function __construct(Client $redis, $key) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * @param Rpc $rpc |
||
| 43 | */ |
||
| 44 | 25 | public function enqueue(Rpc $rpc) |
|
| 50 | |||
| 51 | /** |
||
| 52 | * @return PromiseInterface |
||
| 53 | */ |
||
| 54 | 25 | public function dequeue() |
|
| 62 | |||
| 63 | /** |
||
| 64 | * @return int |
||
| 65 | */ |
||
| 66 | 25 | public function count() |
|
| 70 | |||
| 71 | 26 | protected function updatedLength() |
|
| 79 | } |
||
| 80 |