yf_wrapper_job classCore jobs wrapper.
| File | classes/yf_wrapper_job.class.php |
|---|---|
| Use | _class('wrapper_job') |
A site sets them in its config with $PROJECT_CONF['wrapper_job']['NAME'] = ...;
| Property | Default | Description |
|---|---|---|
$_connection |
null |
|
$driver |
'redis' |
|
$statuses |
['waiting', 'running', 'failed', 'complete'] |
public function add($text = false, $queue = false)
Add new item into named queue.
public function add($text = false, $queue = false)
{
! $this->_connection && $this->connect();
return $this->_connection->add($text, $queue);
}
public function conf($params = [])
Configure driver.
public function conf($params = [])
{
! $this->_connection && $this->connect();
return $this->_connection->conf($params);
}
public function connect()
Do connect to the low level driver.
public function connect()
{
if ( ! $this->_connection) {
$this->_connection = queue()->connect();
}
return $this->_connection;
}
public function del($queue = false)
Delete one item from the queue.
public function del($queue = false)
{
! $this->_connection && $this->connect();
return $this->_connection->del($queue);
}
public function get($queue)
Get one item from named queue (dequeue).
public function get($queue)
{
! $this->_connection && $this->connect();
return $this->_connection->get($queue);
}
public function is_ready()
Check if queue system is ready for processing.
public function is_ready()
{
! $this->_connection && $this->connect();
return (bool) $this->_connection;
}
public function status($queue = false, $job = null)
Get job status.
public function status($queue = false, $job = null)
{
! $this->_connection && $this->connect();
return $this->_connection->del($queue);
}
_ hooks and helpers; not routable as page actionspublic function __call($name, $args)
Catch missing method call.
public function __call($name, $args)
{
// Support for driver-specific methods
if (is_object($this->_connection) && method_exists($this->_connection, $name)) {
return call_user_func_array([$this->_connection, $name], $args);
}
return main()->extend_call($this, $name, $args);
}