Posts Learn Components Snippets Categories Tags Tools About
/

How to Clear Application Cache in Laravel

Learn how to clear application cache in Laravel the easy way

Created on Oct 26, 2021

65 views

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

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

Load comments for How to Clear Application Cache in Laravel

)