momokang / laravel-clean-file-cache
Clean up expired laravel cache files if system is using file as cache driver
Requires
- php: >=5.6.4
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2025-08-28 11:50:04 UTC
README
When using file as cache driver, Laravel creates cache files but never purges expired ones. This can lead to server overload of cache files which drained up storage spaces.
This package creates an artisan command cache:cleanup
that will clean up your cache files, removing any that had expired.
You may run this manually or include it in a schedule.
Thanks to TerrePorter for his suggestion on laravel.io!
Thanks to jdavidbakr for his packagist but I decided to learn how to create my own packagist and how this formed!
Install
Via Composer
$ composer require momokang/laravel-clean-file-cache
Then add the service provider to app/Console/Kernel.php
in the $commands array:
\momokang\CleanFileCache\CleanFileCache::class
Usage
$ php artisan cache:cleanup
$ php artisan cache:cleanup 48
where 48 is known as 48 hours, you can change the integer to suit your needs
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please raise an issue.
Credits
License
The MIT License (MIT). Please see License File for more information.