Get the App
SLTechnology News&Howtos  ›  Development  › 

How to delete route cache by laravel

Shulou Source: shulou.com Published: 2022-06-03 10:36:49 11月15日 Update

This article mainly introduces laravel how to delete the routing cache, the article is very detailed, has a certain reference value, interested friends must read it!

Laravel delete route cache method: 1, log in to the system running laravel application and open the terminal; 2, navigate to the Laravel project directory; 3, execute the "php artisan route:clear" command to clear the route cache.

The operating environment of this tutorial: windows7 system, Laravel5 version, Dell G3 computer.

Routing cach

Closure-based routes cannot be cached. To use routing caching, you need to move the code from the closure to the controller class.

If your application uses only controller-based routing, you should take advantage of Laravel's route cache. Route caching greatly reduces the time required to register all routes. In some cases, route registration can be even 100 times faster. To generate a route cache, simply execute the artisan command route:cache:

Php artisan route:cache

After running this command, the cached route file is loaded on each request. Remember, if any new routes are added, the new route cache needs to be regenerated. Therefore, you should run the route:cache command when the project is deployed.

You can use the route:clear command to clear the route cache:

Log in to the system running the laravel application and open the terminal, then navigate to the Laravel project directory and clear the cache using the following command

Php artisan route:clear above is all the contents of the article "how to delete the routing cache in laravel". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Routing caching commands runs applications programs systems projects applications content controllers directories articles terminals closures navigation control generation login code Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MySQL Huawei Apple Shulou Technology