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

Laravel Append Query String to Route in Laravel

How to Append Query String to Route in Laravel ?

November 22, 2023March 16, 2024

In this guide, we’ll explore the methods and best practices on append query string to route in Laravel. One common requirement is appending query strings to routes, a task often encountered when dealing with dynamic data and user interactions. Understanding Query Strings and Routes in Laravel Before diving into the techniques,…

Read More
Laravel How to Find the laravel version and location

How to find installed laravel version?

March 5, 2022March 5, 2022

To find the installed laravel version in command line we can use artisan command and to find the laravel version in application code we can use app method. In this article i will show you to get the version of laravel version in both ways using command line and in…

Read More
Php How to Concat Two Columns in Laravel Eloquent Query With Search

How to Concat Two Columns in Laravel Eloquent Query With Search ?

June 22, 2022June 22, 2022

In this article we will learn to use aggregate function concat in laravel eloquent with search and query builder. Concat is used to join two columns and in laravel eloquent there is no method for concat but we can use DB builder to use native MySQL Methods. In MySQL or…

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

  • 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

  • The Resilience of Nature: How Forests Recover After Fires
  • Understanding Laravel Cookie Consent for GDPR Compliance
  • Understanding High Vulnerabilities: A Critical Overview of the Week of May 12, 2025
  • Installing a LAMP Stack on Ubuntu: A Comprehensive Guide
  • Understanding High Vulnerabilities: A Deep Dive into Recent Security Concerns
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version