Laravel - How to clear cache

Published by Theodoros Kafantaris

Jun 05, 2024

One Command Clear all Cache

It clears all the cached data that Laravel may have generated to optimize performance. This includes clearing the application cache, route cache, configuration cache, compiled views, and other cached data.

php artisan optimize:clear


Clear Application Cache

It removes all items from the default cache store used by the application. This can include data cached from database queries, API calls, and other operations that have been cached to improve performance.

php artisan cache:clear


Clear Configuration Cache

This command will invalidate the cached configuration, ensuring that any changes to the configuration files are applied.

php artisan config:cache


Clear Route Cache

This command will clear the cached routes. This is important when new routes are added or existing routes are modified.

php artisan route:cache


Clear View Cache

This command also clears compiled Blade views, ensuring that any changes to view files are reflected the next time the views are rendered.

php artisan view:clear



Ⓒ 2024. All rights reserved by atomic