BLPOP to pop an element from the head of the first non-empty list, blocking until one has an element or the timeout expires.
It is the blocking form of LPOP and it accepts several keys, which are checked in the order given, so earlier keys act as higher priority queues. The reply names the key the element came from together with the element itself, which matters when you are waiting on more than one queue.
The timeout is in seconds, may be fractional, and 0 waits indefinitely; when it expires the reply is null. Blocking lets a worker wait for work without polling, which cuts both latency and wasted commands. When several clients are blocked on the same key they are served in the order they started waiting.
Syntax
Arguments
Important points
- A blocking form holds the request until data arrives or its timeout expires. Set the client/network timeout longer than the command timeout.
Response
The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.
Examples
TCP examples use the TLSREDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
Redis CLI
Redis CLI
@upstash/redis
@upstash/redis
This command is not supported yet in
@upstash/redis.upstash_redis
upstash_redis
This command is not supported yet in
upstash_redis.ioredis
ioredis
node-redis
node-redis
redis-py
redis-py
go-redis
go-redis
jedis
jedis
redis-rs
redis-rs