Looks like I spent ages trying to figure this one out!
I’m using Redis as queue driver to push some jobs.
Here’s what was pushed:
127.0.0.1:6379> keys * 1) "laravel_queues:default:notify" 2) "laravel_database_queues:default:notify" 3) "laravel_database_queues:default" 4) "laravel_queues:default"
Now I could easily see the data within the list using:
lrange laravel_database_queues:default 0 -1
Easy right!
Now lets try getting the same thing within the Laravel application (which uses Phpredis library behind the scene):
Redis::lrange('laravel_database_queues:default', 0, -1);
[]
Empty array!
I couldn’t figure out why!
Turns out Laravel prefixes the queues, in my case it prefixed the queue with laravel_database_
What I didn’t know if that you must drop the prefix when trying to retrieve the items from the queue!
In my case I had to:
Redis::lrange('queues:default', 0, -1);
Interesting that this isn’t mentioned anywhere in the docs! it magically adds the queue prefix to whatever KEY we use in lrange!
Anyways, hope this helps someone who’s having to use queues!