Categories
Laravel

Clearing Route, View, Config Cache in Laravel 5.8

Sometimes you may face an issue that the changes to the Laravel Project may not update on the web. This occures when the application is served by the cache. In this tutorial, You’ll learn to Clear ApplicationRouteConfigBrowser Cache in Laravel Project.

Go to your Laravel Project and open the Terminal. Here you can type the commands to clear cache as show below :

  1. Clear Route Cache

Type the following command to clear route cache of the Laravel application.

php artisan route:cache
Code language: CSS (css)
  1. Optimize Laravel Cache

Note : The Artisan optimize command is deprecated as of 5.5. With recent improvements to PHP itself including the OPcache, the optimize command no longer provides any benefit.

php artisan optimize
  1. Clear Application Cache

Type the following command to clear application cache of the Laravel application.

php artisan cache:clear
Code language: CSS (css)
  1. Clear Configuration Cache

Type the following command to clear configuration cache of the Laravel application.

php artisan config:cache
Code language: CSS (css)
  1. Clear View Cache

Type the following command to clear view cache of the Laravel application.

php artisan view:clear
Code language: CSS (css)
  1. Clear Browser Cache

You can clear the cache by defining the command inside the router.Then access this URL in the browser to clear the cache of Laravel project.

Route::get('/clear-cache', function() { Artisan::call('cache:clear'); return "Cache is cleared"; });
Code language: PHP (php)

Hope this tutorial helped you! Feel free to drop your opinion at the comment section.

Leave a Reply

Your email address will not be published. Required fields are marked *