2024-01-18 13:47:17 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
|
|
|
|
|
class CleanupQueue extends Command
|
|
|
|
{
|
|
|
|
protected $signature = 'cleanup:queue';
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2024-01-18 13:47:17 +00:00
|
|
|
protected $description = 'Cleanup Queue';
|
|
|
|
|
|
|
|
public function handle()
|
|
|
|
{
|
2024-01-18 13:56:12 +00:00
|
|
|
echo "Running queue cleanup...\n";
|
2024-01-18 13:47:17 +00:00
|
|
|
$prefix = config('database.redis.options.prefix');
|
|
|
|
$keys = Redis::connection()->keys('*:laravel*');
|
|
|
|
foreach ($keys as $key) {
|
|
|
|
$keyWithoutPrefix = str_replace($prefix, '', $key);
|
|
|
|
Redis::connection()->del($keyWithoutPrefix);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|