Search code examples
laravelvagrant

Laravel 5.6 cache issue on Vagrant machine


Stack Envionment:

Laravel 5.6
Homestead: 8.2.1
Vagrant: 2.2.7 
PHP: 7.3.9
IDE: Phpstorm 2019.2.3

Problem: Cache is not clearing when i try to run every cache clear command such as:

php artisan optimize:clear
php artisan cache:clear
php artisan optimize

Please note: I have tried every single cache clear command avaliable, also deleted vendor and reinstalled and it still points to the previous vendor installed...

How i noticed: Currently trying to just test a job in tinker and dispatching the job as a Queue. Then checking the output.

For example:

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class foo implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;


    public function __construct(){}

    public function handle(){ echo 'bar';}
}

Dispatching this job will echo foo but when i change it to bar, it will still echo foo.

Currently having to run vagrant reload which solves the issue, but i need to keep doing this for upon every job class change.

Homestead.yml

ip: 192.168.10.12
version: 8.2.1
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
    - ~/.ssh/id_rsa
folders:
    -
        map: /Users/user/Sites/test-package
        to: /home/vagrant/code
sites:
    -
        map: homestead.test
        to: /home/vagrant/code/public
        php: "7.3"
databases:
    - homestead
name: test-package
hostname: test-package

Driver Settings

# Driver Settings
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=database

Solution

  • To update your queue jobs with changes you can run.

    php artisan queue:restart