What is Laravel cache?
Laravel is a popular PHP framework for building websites. A framework is a ready-made base that saves you from writing everything yourself. To run faster, Laravel saves some work in cache files. Cache is a store of saved results. If you change a setting or a route and the site still acts the old way, the cache may be stale. Clearing it fixes that.
You run these commands with Artisan. Artisan is Laravel's built-in command tool. You need SSH access. SSH is a safe way to type commands on a server from far away. Ask Hostvento support if your plan includes it.
Steps
- Log in to your server with SSH.
- Go to your Laravel project folder, the one that has a file named
artisan.cd /path/to/your/project - Clear the application cache.
This removes data your code has stored in the cache.php artisan cache:clear - Clear the configuration cache.
Use this after you edit yourphp artisan config:clear.envfile. - Clear the route cache.
Use this when new routes do not work. A route is a web address your app knows about.php artisan route:clear - Clear compiled view files.
Views are the page templates. Use this when a template change does not appear.php artisan view:clear
Clear everything at once
php artisan optimize:clear
This one command clears config, route, view, event and compiled caches in newer Laravel versions.
Build the cache again
On a live site, caching speeds things up. After clearing, you can rebuild it.
php artisan config:cache
php artisan route:cache
php artisan view:cache
storage folder is writable.If you cannot use SSH
You can delete the files inside bootstrap/cache and storage/framework/cache with the File Manager. Do not delete the folders themselves. Take a backup first.
Quick recap
- Use
php artisan cache:clearfor app cache. - Use
config:clear,route:clear,view:clearfor the others. optimize:cleardoes most of it in one go.