how to clear cache in laravel

Posted On:

Posted In:

Cache memory can cause some frustrating issues in web development. If your site isn’t showing the intended view after updating, the cache memory may be the reason. You should regularly clear the cache to seamlessly run your web application. 

Here are some commands you can use to clear cache in the Laravel framework. 

Clear all stored cache in storage/cache:

To clear application cache, run this command: 

php artisan cache:clear 

Clear route cache: 

To clear route cache, run this command:

php artisan route:clear 

Clear view cache: 

To clear view cache, run this command:

php artisan view:clear 

Clear class cache: 

To clear class cache, run this command: 

php artisan config:cache 

Reoptimized class loader: 

To reoptimize the class loader, run this command: 

php artisan optimize 

How to clear cache in shared hosting servers:

To clear Shared Hosting Server cache, run this command:

Route::get(‘/clear-cache’, function() { 

    Artisan::call(‘cache:clear‘); 

    return “Cache is cleared”; 

}); 

Conclusion

Cache memory can sometimes create a problem at development time when you don’t regularly erase it. These are some commands you should use to prevent cache memory from messing up with your program outputs. 

If you are looking for a software firm to create your business website or mobile app, your search ends here. We build affordable and robust software solutions for businesses to digitally thrive on. Contact us to get a quote. You can mail us at  [email protected] or WhatsApp us on +91 95 37 84 38 39.

Latest Posts

best wordpress builder

Block Editor vs Divi vs Elementor: Choosing Best WordPress Builder

March 13, 2024

A few years back website creation demanded a lot of technical knowledge and proficiency in HTML, CSS, and JavaScript. The scenario has changed, building a user-friendly website with no code is possible. Today, a variety…

How to publish only approved content in WordPress

How to publish only approved content in WordPress?

March 9, 2024

‘Why did you post without approval?’ this question is often part of the discussion when more than two people handle the content part of the WordPress website. Seeking approval before posting not only helps to…

Leave a Reply

Your email address will not be published. Required fields are marked *