1 | <?php |
||
20 | class RedisQueue extends Model |
||
21 | { |
||
22 | /** |
||
23 | * @see Queue::isWaiting() |
||
24 | */ |
||
25 | const STATUS_WAITING = 1; |
||
26 | /** |
||
27 | * @see Queue::isReserved() |
||
28 | */ |
||
29 | const STATUS_RESERVED = 2; |
||
30 | /** |
||
31 | * @see Queue::isDone() |
||
32 | */ |
||
33 | const STATUS_DONE = 3; |
||
34 | /** |
||
35 | * @var Serializer|array |
||
36 | */ |
||
37 | public $serializer = PhpSerializer::class; |
||
38 | |||
39 | public $prefix; |
||
40 | |||
41 | 5 | public function __construct(array $config = []) |
|
47 | |||
48 | 5 | public function setPrefix() |
|
52 | |||
53 | |||
54 | 5 | public function getPrefix() |
|
59 | |||
60 | public function setWaiting() |
||
64 | |||
65 | public function getWaiting() |
||
70 | |||
71 | public function setDelayed() |
||
75 | |||
76 | public function getDelayed() |
||
81 | |||
82 | public function setReserved() |
||
86 | |||
87 | public function getReserved() |
||
92 | |||
93 | 1 | public function setTotal() |
|
97 | |||
98 | 1 | public function getTotal() |
|
103 | |||
104 | 1 | public function setDone() |
|
108 | |||
109 | 1 | public function getDone() |
|
114 | |||
115 | 1 | public function getWorkInfo() |
|
116 | { |
||
117 | 1 | $workers = []; |
|
118 | 1 | $data = Yii::$app->queue->redis->clientList(); |
|
119 | foreach (explode("\n", trim($data)) as $line) { |
||
120 | $client = []; |
||
121 | foreach (explode(' ', trim($line)) as $pair) { |
||
122 | list($key, $value) = explode('=', $pair, 2); |
||
123 | $client[$key] = $value; |
||
124 | } |
||
125 | |||
126 | if (isset($client['name']) && strpos($client['name'], Yii::$app->queue->channel . '.worker') === 0) { |
||
127 | $workers[$client['name']] = $client; |
||
128 | } |
||
129 | } |
||
130 | return $workers; |
||
131 | } |
||
132 | |||
133 | public function getWaitContent() |
||
138 | |||
139 | public function getReservedContent() |
||
143 | |||
144 | public function getDelayedContent() |
||
148 | |||
149 | 1 | public function getMessage($id) |
|
155 | |||
156 | public function getAttempt($id) |
||
162 | |||
163 | |||
164 | /** 得到执行时间 |
||
165 | * @param $id todo |
||
166 | */ |
||
167 | public function getExecutionTime($id) |
||
170 | |||
171 | /** 得到队列的状态 |
||
172 | * @param $id |
||
173 | * @return int |
||
174 | */ |
||
175 | 1 | public function status($id) |
|
185 | } |
||
186 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.