Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shadrix's avatar
Level 12

Do you ever call "php artisian cache:clear" in production?

This might be a stupid question. But I'm not really sure if there is a situation where you need to clear the cache in production.

So: Do you ever call php artisian cache:clear in production?

0 likes
4 replies
MichalOravec's avatar

If you update your app then

php artisian cache:clear

is necessary.

Also you can make a button in your administration where you will call Cache::flush();

shadrix's avatar
Level 12

@michaloravec Do you have any knowledge perhaps about Redis cluster? Because if you are calling php artisian cache:clear you are also firing the command FLUSHDB. Wouldn't this also delete everything you have in queues and in sessions?

That was the reason why I have asked the question if you ever call cache:clear in production.

Example source: https://aregsar.com/blog/2020/my-laravel-redis-configuration/ In this example for Redis Cluster, all the database values are set to 0

MichalOravec's avatar

@shadrix Look here

https://github.com/laravel/laravel/blob/master/config/cache.php#L77

you can see that redis use cache connection

and cache connection of redis has database set to 1 by default Laravel app

https://github.com/laravel/laravel/blob/master/config/database.php#L142

Which means if you run

php artisian cache:clear

It just remove cached data from database and don't touch queues or sessions.

So you are really save to use it in production.

Please or to participate in this conversation.