src/Queue/Beanstalk.php
public function put($job, $options = null)
    {
        if ($job instanceof JobInterface) {
            if ($job->isRunOnce()) {
                $cacheKey = self::CACHE_JOB . get_class($job);
                if ($this->getCache()->get($cacheKey) === null) {
                    $expire = $job->getDelay() + $job->getTtr() + 60;
                    $this->getCache()->save($cacheKey, 1, $expire);
                } else {
                    return true;
                }
            }
            $options = [
                'delay' => $job->getDelay(),
                'ttr' => $job->getTtr(),
                'priority' => $job->getPriority()
            ];
        }
        $this->getLogger()->info('Add job ' . json_encode($job));
        return parent::put($job, $options);
    }
public function put($job, $options = null)
    {
        if ($job instanceof JobInterface) {
            if ($job->isRunOnce()) {
                $cacheKey = self::CACHE_JOB . get_class($job);
                if ($this->getCache()->get($cacheKey) === null) {
                    $expire = $job->getDelay() + $job->getTtr() + 60;
                    $this->getCache()->save($cacheKey, 1, $expire);
                } else {
                    return true;
                }
            }
            $options = [
                'delay' => $job->getDelay(),
                'ttr' => $job->getTtr(),
                'priority' => $job->getPriority()
            ];
        }
        $this->getLogger()->info('Add job ' . json_encode($job));
        return parent::put($job, $options);
    }
public function put ( $ job , $ options = null ) { if ( $ job instanceof JobInterface ) { if ( $ job -> isRunOnce ( ) ) { $ cacheKey = self :: CACHE_JOB . get_class ( $ job ) ; if ( $ this -> getCache ( ) -> get ( $ cacheKey ) === null ) { $ expire = $ job -> getDelay ( ) + $ job -> getTtr ( ) + 60 ; $ this -> getCache ( ) -> save ( $ cacheKey , 1 , $ expire ) ; } else { return true ; } } $ options = [ 'delay' => $ job -> getDelay ( ) , 'ttr' => $ job -> getTtr ( ) , 'priority' => $ job -> getPriority ( ) ] ; } $ this -> getLogger ( ) -> info ( 'Add job ' . json_encode ( $ job ) ) ; return parent :: put ( $ job , $ options ) ; }
Inserts jobs into the queue

@param mixed $job JobInterface or any data
@param array options
Inserts jobs into the queue