Download the PHP package arifhp86/laravel-clear-expired-cache-file without Composer
On this page you can find all versions of the php package arifhp86/laravel-clear-expired-cache-file. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-clear-expired-cache-file
Clear Expired Cache Files
When you use the file
cache driver, you may have noticed that the cache files are never deleted automatically. They are overwritten when the cache is refreshed which is good, but if there is some randomness in you cache keys, or for some other reason some of your cache files are never touched again, they will stay on your server forever. This package helps you to get rid of these lingering files.
This package only adds one artisan command: php artisan cache:clear-expired
and it will delete all cache files that has already been expired.
Installation
You can install the package via composer:
Usage
Run the following command
Run on schedule
You can also schedule the command to run automatically. For example, if you want to run the command every day at 1 AM, you can add the following to your app/Console/Kernel.php
file:
Dry run
You can run the command in dry run mode. In this mode, the command will not delete any files. It will only show you the files that will be deleted if you run the command without the --dry-run
option.
Disable directory deletion
By default, the command will delete all empty directories after deleting the expired files. You can disable this behavior by using the --disable-directory-delete
option.
Events
The command triggers three events:
Arifhp86\ClearExpiredCacheFile\Events\GarbageCollectionStarting
: Before the command runs.Arifhp86\ClearExpiredCacheFile\Events\GarbageCollectionEnded
: After the command runs.Arifhp86\ClearExpiredCacheFile\Events\GarbageCollectionFailed
: If the command fails.
You can use these events to run your own code before or after the command runs.
Send email notification after the command runs
Send email notification if the command fails
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Arifur Rahman
- All Contributors
License
The MIT License (MIT). Please see License File for more information.