New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

jdavidbakr/laravel-cache-garbage-collector

A script that will clean up expired cache files if the system is using the files cache system
181,585 58
Install
composer require jdavidbakr/laravel-cache-garbage-collector
Latest Version:2.4
PHP:>=7.1.0
Laravel:8 – 13
Older releases:5 · 6 · 7
License:MIT
Last Updated:Jun 9, 2026
Links: GitHub  ·  Packagist
Maintainer: jdavidbakr

LaravelCacheGarbageCollector

Latest Version on Packagist Software License Total Downloads Travis CI

When using the file cache driver, Laravel creates the cache files but never purges expired ones. This can lead to a situation where you have a large number of unused and irrelevant cache files, especially if you do a lot of short-term caching in your system.

This package creates an artisan command cache:gc that will garbage-collect your cache files, removing any that have expired. You may run this manually or include it in a schedule.

Thanks to TerrePorter for his suggestion on laravel.io!

Install

Via Composer

$ composer require jdavidbakr/laravel-cache-garbage-collector

Then add the service provider to app/Console/Kernel.php in the $commands array:

\jdavidbakr\LaravelCacheGarbageCollector\LaravelCacheGarbageCollector::class

Usage

$ php artisan cache:gc

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email me@jdavidbaker.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

jdavidbakr/mail-tracker

Logs and tracks all outgoing emails from Laravel

1,515,428 622
jdavidbakr/replaceable-model

Adds 'REPLACE' and 'INSERT IGNORE' query capability to eloquent models

249,977 72
jdavidbakr/laravel-sns-error-notification

Sends a notification via SNS when there is an exception

20,445 0
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

648,266,899 9,701
laravel/framework

The Laravel Framework.

604,216,237 34,982

Version History

Version Released PHP Laravel License
2.4 >=7.1.0 8.*|9.*|10.*|^11.0|^12.0|^13.0 MIT
2.3 >=7.1.0 8.*|9.*|10.*|^11.0|^12.0 MIT
2.2 >=7.1.0 8.*|9.*|10.*|^11.0 MIT
2.1 >=7.1.0 8.*|9.*|10.* MIT
2.0 >=7.1.0 8.*|9.* MIT