Cache Clear in Laravel

Laravel supports popular caching backends like Memcached and Redis out of the box.

There are 4 types of Cache in Laravel which you can clear by cli:-

  • Application Cache
php artisan cache:clear
  • Route Cache
php artisan route:cache
  • Config Cache
php artisan config:cache
  • View Cache
php artisan view:clear

If you are using Shared Hosting you can run the command out of cli

Route::get('/clear-cache', function() {
    Artisan::call('cache:clear');
    // you can use other cache cleaning commands too
    return "cache:clear";
});

Leave a Reply

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