Disable the cache?

2019-07-11 07:30发布

问题:

I've looked around the web and found you can clear the cache via:

php artisan cache:clear

I am looking for a solution where you can turn off the cache in a dev environment. I do not want to run the above cmd everytime.

 return Cache::remember('my-key', 60, function() {
        //get page
    });

So above I check the cache, this occurs throughout my app, is there a simple way to disable it in a dev environment?

回答1:

Set your cache driver to array in .env file for your DEV environment. This way cache will be wiped out at the end of every request, but you'll be able to use Cache facade.

CACHE_DRIVER=array