How to Clear CACHE in Laravel 5?

CACHE troubles us many times while doing the Laravel Project. Actually almost every programming language and frameworks implement this strategy of storing the runtime/intermediate/temporary variables and configurations in cache. It’s similar to storing our passwords by a web browsers in some cookies.

Because such information are stored in CACHE, our program sometimes doesn’t reflect the latest change that we have made. In Laravel there are few areas which stores the cache i.e. Application, route, config and view files.

Commands below will help to clear the configs in each sections of your Laravel Project.

Clear Application Cache

Application cache stored by Laravel framework can be cleared by typing following command:

$ php artisan cache:clear

Clear Route cache

In order to see the newly created route, if you face some issues, first of all clear the route. In order to do so type the following command:

$ php artisan route:cache

Clear Config Cache

In order to clear the configs from your framework and view the updated configs, type following in your terminal:

$ php artisan config:cache

Clear View Files

While you type php artisan serve, the framework compiles the view and stores them in cache. So sometimes when you make changes in your view, it might not be reflected. Therefore, you should type following to clear the cache:

$php artisan view:clear

These are four areas where the Laravel framework stored cache files. So if it is a big project which has numerous views, routes and controllers, in order to see the changes do clear your caches frequently.