Support the ongoing development of Laravel.io →
Cache Laravel

Hello. I refer to this URL (https://readouble.com/laravel/8.x/en/cache.html) to cache the data in file.

Cache::store('file')->put('bar', 'baz', 600);

At this point, will the cached data that has expired be deleted automatically? If so, at what timing will it be executed? Or, if it is not automatically deleted, do I have to set up my own batch process or something?

Last updated 3 years ago.
0

I'm sorry. I found this article ( https://laravel.io/forum/01-28-2016-cache-file-garbage-collection ) and understood that the cache stored in file in laravel is not deleted automatically.

In my case, since I am using a system where the cache is distributed and stored in redis and file, I adopted a method to delete the file by cron using a shell script.

duncanmcclean liked this reply

1

Sign in to participate in this thread!

Eventy

Your banner here too?

poinchy poinchy Joined 5 Sep 2021

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.