Posts Learn Snippets Categories Tags About
/

How to Cache Route and Cache Config in Laravel 8

Learn the way to cache laravel route and config to better enhance your application loading speed

Created on Jun 26, 2021

12 views

In Laravel, each time a request is made will pass through the lifecycle of the application up till it returns a response. During each of those requests, the routes and configs are read to get the right data and value.

To speed this up you can cache both route and config by running the command below.

Cache the Route
php artisan route:cache

Cache the Config
php artisan config:cache

Do note that any new configuration you have included won't take effect until you "clear" the cache. To clear the cache you can run:

php artisan route:clear

And for the config run it like below.
php artisan config:clear

Created by

PostSrc poster

PostSrc

Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.