Skip to main content

ZMPOP

Note

Official reference: ZMPOP.

Pop low- or high-score members from the first nonempty sorted set.

Syntax

ZMPOP numkeys key [key ...] MIN|MAX [COUNT count]

numkeys must match the key count. Pop from the first nonempty key. MIN/MAX choose lowest/highest scores; COUNT is the maximum to pop, default 1.

Results

ReturnRowsContent
ResultSetmultipleKEY field, STRING type
ELEMENT field, STRING type
SCORE field, DOUBLE type
Caution

When all source sets are empty (or a blocking call times out), the current driver can fail rather than reliably return an empty ResultSet. Use a Redis client when this case must be handled.

Example

ZADD demo:ranking 10 alice 20 bob
ZMPOP 1 demo:ranking MIN COUNT 2