There are several ways to delete Laravel Redis queue jobs and below are the available options.
Option 1 - Laravel Command
The first way to clear a Redis queue is to use the artisan queue clear:command and this is the easiest you can do. Just open up the terminal and type the command below.
php artisan queue:clear [connection] [queue]
This command also works with other queue types such as a database.
Option 2 - Redis CLI
The second way is to use the Redis command and you can access it by typing it below.
redis-cli
once you are in Redis CLI, just run the command below.
FLUSHDB
This will clear all of your Redis cached.
Option 3 - Laravel Facade
Thirdly, If you want to use Laravel facade then you can create a route closure or console command to run the Redis command.
use Redis; Redis::command('flushdb');
BONUS: If you want then you can make use of Laravel tinker.
php artisan tinker
After that run the command the flushdb command by passing it to the method parameters.
\\Redis::command(‘flushdb’);
Above are some of the ways to clear out your Redis cache, there are other ways but those 3 ways above is the most common one and proven tested.
Thank you for reading the tutorial and I hope you managed to learn something. Do comment below to start the discussion of this topic. Cheers 🍻
Leave a reply