Clear cache in laravel 5

Clear database cache

In Laravel php artisan cache:clear command is used to clear cache.
It will remove all the cache associated with the connection to the database.

Usage:

php artisan cache:clear

Further, on shared hosting, you can use below code in your routes/web.php file to remove your database cache.

Route::get('/clear-cache', function() {
    $exitCode = Artisan::call('cache:clear');
    return "Cache is cleared";
});

Clear config cache

To clear config cache of your Laravel application run below command on terminal.

php artisan config:cache  

Clear route cache

To clear route cache of your Laravel application run below command on terminal.

php artisan route:cache  

Leave a Reply

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