Skip to content
Readerstacks logo Readerstacks
  • Home
  • Softwares
  • Angular
  • Php
  • Laravel
  • Flutter
Readerstacks logo
Readerstacks
Clear cache in laravel

How to Clear cache in Laravel 8 ?

Aman Jain, October 15, 2021October 15, 2021

Cache is used to improve the performance of web application using caching the views templates, queries, CSS, JavaScript etc. Cache improves the performance by serving the cached pages and improves the speed of website but sometime develops face issues like they change something in Laravel application but it does not reflect. so in this article we are going g to learn to clear the cache of Laravel application.

There is 2 ways to clear the cache in laravel

  1. Using the command line
  2. Using the browser(If you do not have rights to run artisan command from terminal)

Clear cache from command line in Laravel

To clear from command line or terminal you need to ssh into the server and navigate to our project.

There is 4 types of cache in Laravel

  1. Application cache
  2. Route cache
  3. Configuration cache
  4. View Cache

1. Clear application cache in laravel

Run the below command to clear application cache

php artisan cache:clear

2. Clear route cache in laravel

Run the below command to clear route cache

php artisan route:clear

3. Clear Configuration cache in laravel

Run the below command to clear application cache

php artisan config:clear

4. Clear views cache in laravel

Run the below command to clear application cache

php artisan views:clear

Clear cache of Laravel using browser

Sometime or we can say on shared hosting we are unable to access the ssh or terminal then we are unable to run these above commands. so, Laravel also support to call the artisan command from our application code and we can run them by hitting the URL in browser.

To clear the cache from browser we need to create a route in routes/web.php and then define the below code


Route::get('/clear-cache', function() {
    Artisan::call('cache:clear');
    Artisan::call('config:clear');
    Artisan::call('views:clear');
    return "Cache is removed";
});

Related

Laravel Php

Post navigation

Previous post
Next post

Related Posts

Php Laravel orderBy clause in eloquent with example

Laravel orderBy clause in eloquent with example

October 5, 2022March 16, 2024

In this blog post, we will take a look at how to use the Laravel orderBy clause in the Eloquent ORM.Laravel provides an expressive, fluent interface for creating and retrieving records in your database. When we work with databases in Laravel, we often need to order the results we get…

Read More
Php How to Change Date Format in Blade View File in Laravel

How to Change Date Format in Blade View File in Laravel ?

September 8, 2022March 16, 2024

Laravel default shows the date in the way its stored in database bu sometimes we want to change date format in blade view file in laravel according to our requirements. It can be multiple possibilities and requirement from client or product manager to change the date format so in this…

Read More
Php How to Add Captcha, validate and refresh captcha in Laravel Form

How to Add Captcha, validate and refresh captcha in Laravel Form ?

March 10, 2022November 17, 2023

Captcha is used to enhance the security of form. By adding the Captcha in laravel form we can prevent attackers to submit the form using the automated scripts and it adds an extra layer of security. To add the captcha in laravel form we can use package mews/captcha, its easy…

Read More

Aman Jain
Aman Jain

With years of hands-on experience in the realm of web and mobile development, they have honed their skills in various technologies, including Laravel, PHP CodeIgniter, mobile app development, web app development, Flutter, React, JavaScript, Angular, Devops and so much more. Their proficiency extends to building robust REST APIs, AWS Code scaling, and optimization, ensuring that your applications run seamlessly on the cloud.

Categories

  • Angular
  • CSS
  • Dart
  • Devops
  • Flutter
  • HTML
  • Javascript
  • jQuery
  • Laravel
  • Laravel 10
  • Laravel 11
  • Laravel 9
  • Mysql
  • Php
  • Softwares
  • Ubuntu
  • Uncategorized

Archives

  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • October 2024
  • July 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • July 2023
  • March 2023
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Recent Posts

  • Mapping Together: The Vibrant Spirit of OpenStreetMap Japan
  • Understanding High Vulnerabilities: A Deep Dive into the Weekly Summary
  • Building a Million-Dollar Brand: The Journey of Justin Jackson
  • Mastering Schedule Management with Laravel Zap
  • The Resilience of Nature: How Forests Recover After Fires
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version