Skip to main content

BRPOP

Note

Official reference: BRPOP.

Wait for an element and pop from the right end.

Syntax

BRPOP key [key ...] timeout

timeout is in seconds. Use a nonnegative integer literal; 0 waits indefinitely. The example inserts elements before waiting.

Results

ReturnRowsContent
ResultSetmultipleELEMENT field, STRING type
Caution

With data, returns two ELEMENT rows: the key name first, then the element, not two columns in one row. Empty-queue timeouts can currently fail; use a Redis client for consumers requiring reliable timeout handling.

Example

RPUSH demo:queue first second
BRPOP demo:queue 1