1 | <?php |
||
7 | class RedisDriver implements DriverInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var Redis |
||
11 | */ |
||
12 | private $redis; |
||
13 | |||
14 | /** |
||
15 | * @param Redis $redis |
||
16 | */ |
||
17 | 4 | public function __construct(Redis $redis) |
|
18 | { |
||
19 | 4 | $this->redis = $redis; |
|
20 | 4 | } |
|
21 | |||
22 | /** |
||
23 | * @inheritdoc |
||
24 | */ |
||
25 | 1 | public function enqueue($queue, $command) |
|
29 | |||
30 | /** |
||
31 | * @inheritdoc |
||
32 | */ |
||
33 | 2 | public function dequeue($queue) |
|
34 | { |
||
35 | 2 | list(, $message) = $this->redis->blPop($queue, static::TIMEOUT) ?: null; |
|
36 | |||
37 | return [ |
||
38 | 2 | unserialize($message), |
|
39 | 2 | null, |
|
40 | 2 | ]; |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * @inheritdoc |
||
45 | */ |
||
46 | 1 | public function processed($job) |
|
50 | } |
||
51 |