Have you ever experienced your laravel application stuck or not read the latest code updates?
For example, like your new route that suddenly becomes 404 not found, your view does not read the latest display updates, the data received from the database is not the latest or even your .env setting becomes 500 errors?
Most likely it's the influence of the laravel cache. By default laravel will cache your route, view, and config .env. The command to cache for example is as follows:
php artisan route:cache
php artisan config:cache
It must be very annoying not if your updates are not readable. Suddenly 404 not found aja gja that, especially if deployed to production, beuhhh where the boss nungguin fix again :D.
Well do not need a lot of pleasantries, here is the code to clear the cache in laravel:
Clear cache route:
php artisan route:clear
Clear cache view:
php artisan view:clear
Clear cache config and .env :
php artisan config:clear
Clear cache in general or cache created by yourself:
php artisan cache:clear
Before you push to git or deploy to the server it's a good thing you clear all the cache in your laravel application first, this is so that your update becomes fresh on the remote git or server later.
But bro, that's too much command to just clear the cache. Ok, calm down, man, there is a solution that is all in one, which is to use optimize:clear
php artisan optimize:clear
Now an error of 404 because the cache will be gone. So and thank you for reading my first article, see you in the next article.
Anyway, you can find me on Github
Comments (1)