How to Clear Cache In Laravel 8 ?

Laravel 8

Nicesnippets

227

17-10-2020


How to Clear Cache In Laravel 8 ?

Hi Guys,

In this tutorial, we are going to learn how to clear route cache, laravel application cache, config cache, view cache and reoptimized class in a Laravel 8 application using artisan command-line interface.

Sometime we need to cache clear when you change in configuration file or any thing change on view file

after long time. so bellow command will help you to clear cache in laravel 8.

commerce website with gitlab. I was fetching one issue suddenly my view cache with error during development. i did try lot to refresh and something other but i can't see any more change in my view, but at last I did resolve my problem using laravel command so, let's see i added several command for clear cache from view, route, confir etc.

Clear Cache:


php artisan cache:clear

Clear Route Cache:

php artisan route:cache

Clear View Cache:

php artisan view:clear

Clear Config Cache:

php artisan config:cache

You can also clear cache without command using route. so you can create route as like bellow:

Route::get('/cache-clear', function() {

Artisan::call('cache:clear');

dd("cache clear All");

});

It will help you...


Recommended Posts