拉拉维尔不知从何而来的工作打电话给班级


Laravel job calling class from nowhere?

我的Laravel项目(v.4.2)有一份工作。 用于将数据插入数据库。名为"产品更新"的类。我使用 Amazon SQS 提供队列服务。

现在让我感到困惑的是,当我在"产品更新"类中更改代码时,作业似乎正在使用旧版本的类运行。

我什至删除了类中的所有代码行,但作业仍然可以运行(它仍然插入数据)。

以下是作业类。

此类的文件位于 app/jobs/ProductUpdate.php

在我的理解中,作业类是唯一会从队列中调用的地方,但是为什么当我删除所有代码时它仍然可以运行?

<?php
/**
 *  Here is a class to run a queued item sent from SQS
 *  Default method to use is fire()
**/
class ProductUpdate
{
    public function fire($job, $data)
    {
        // Disable query log
        DB::connection()->disableQueryLog();
        // Set the job as a var so it will be used across functions
        $this->job = $job;
        $product = Product::find($productID);
        if($product->product_type != 18) {
            // Call the updater from library
            $updater = App::make('Product'PriceUpdater');
            $updater->update($product); 
         }
        // Done and delete
        $this->success();
    }
    private function success()
    {
        $this->job->delete();
    }
    private function fail($messages = array())
    {
        Log::error('Job processing fail', $messages);
        $this->job->delete();
    }
}

您的问题与缓存有关。

在终端中运行此命令以删除所有缓存的数据。

php artisan cache:clear

其他方式:-

Illuminate'Cache'FileStore具有刷新功能,因此您也可以使用它:

Cache::flush();

此链接还将帮助您:)