unable to call illuminate class from resque worker

丶灬走出姿态 提交于 2019-12-11 17:45:01

问题


I have just started using resque in my application, I have created a worker and can queue jobs up. I am having issues though using illuminate classes in my worker. below is the error i am seeing in the worker.

PHP Fatal error:  Class 'Redis' not found in path/to/worker

Here is my worker class:

class SvrRestart {

    public function setUp() {
       // ... Set up environment for this job
    }

    public function perform() {
       $instance = $this->args['instance'];

       Redis::del('restart:' . $instance);

    }

    public function tearDown() {
    // ... Remove environment for this job
    }

}

I have also tried adding the following to the top of the worker:

use Illuminate\Support\Facades\Redis as Redis

this returns the following error:

PHP Fatal error:  Call to a member function del() on a non-object in    path/to/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 206

do I need to do something special to use illuminate classes in my worker?

来源:https://stackoverflow.com/questions/20527586/unable-to-call-illuminate-class-from-resque-worker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!