yf_wrapper_job class

Core jobs wrapper.

Fileclasses/yf_wrapper_job.class.php
Use_class('wrapper_job')

Public properties

A site sets them in its config with $PROJECT_CONF['wrapper_job']['NAME'] = ...;

PropertyDefaultDescription
$_connection null
$driver 'redis'
$statuses ['waiting', 'running', 'failed', 'complete']

Public methods 8

add

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);
    }

conf

public function conf($params = [])

Configure driver.

    public function conf($params = [])
    {
        ! $this->_connection && $this->connect();
        return $this->_connection->conf($params);
    }

connect

public function connect()

Do connect to the low level driver.

    public function connect()
    {
        if ( ! $this->_connection) {
            $this->_connection = queue()->connect();
        }
        return $this->_connection;
    }

del

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);
    }

get

public function get($queue)

Get one item from named queue (dequeue).

    public function get($queue)
    {
        ! $this->_connection && $this->connect();
        return $this->_connection->get($queue);
    }

is_ready

public function is_ready()

Check if queue system is ready for processing.

    public function is_ready()
    {
        ! $this->_connection && $this->connect();
        return (bool) $this->_connection;
    }

status

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);
    }

Methods starting with _ hooks and helpers; not routable as page actions

__call

public 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);
    }