Home / Snippets / How to Clear Application Cache in Laravel
How to Clear Application Cache in Laravel cover

How to Clear Application Cache in Laravel

145

2 years ago

0 comments

There are several caches in Laravel and to clear the application cache you can make use of the artisan command. The cache in Laravel stores all of the cache that your application created and depending on how you specify the command, you can clear specific cache or altogether.

Laravel Clear Application Cache


To clear your Laravel application cache you can run the command below.
php artisan cache:clear

Laravel Clear Cache for Specific Store


You can also make use of multiple cache stores in Laravel and depending on the types of the stores, you can specify it using the "--store=" flag.
php artisan cache:clear --store=memcached
php artisan cache:clear --store=redis

Laravel Clear Cache for Specific Tags/22)
If the cache is tagged then you can run the cache:clear with the "--tags=" flag.

php artisan cache:clear --tags=tag1,tag2,tag3

Programmatically Clear Cache in Laravel


Otherwise, you can also programmatically run the cache clear by running the code below.
<?php

cache()->flush();
cache()->store('redis')->tags('tag1')->flush();

Other Reads

notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this