zremrangebyrank
This block is part of the redis group and was last modified in core v15.0.3.
Redis Key Selection Required
This block relies on a Redis key to perform its redis releated actions. You must manually select the Redis key you want to use in the flow in the blueprint using the Redis key selector modal. To access the modal, click the white button on the block.
zremrangebyrank v15.0.3 Removes the members of a sorted set by position, or all but the N with the highest scores.
- flow
- set
valuerequiredkey of the sorted set
- keep highest
numberkeep this many members with the highest scores and remove the rest
- start
numberfirst position to remove, 0 is the lowest score
- stop
numberlast position to remove, -1 is the highest score
- flow
- removed
number - success
condition - error
value - key
value
Two forms, never mixed. keep_highest N keeps the N members with the highest scores and removes the rest: a list of recents scored by time, capped at N after each redis_set_zadd. Or start and stop, 0-based positions counted from the lowest score, negative from the highest (-1 is the highest): start 0, stop 0 removes the lowest one; start 0, stop -1 empties the set; keep_highest N is start 0, stop -(N+1). removed is how many members went. Nothing has a default: MISSING_START_POSITION or MISSING_STOP_POSITION for a range with one end, INVALID_RANGE for a position that is not a number or for keep_highest together with a position, INVALID_KEEP for a keep_highest that is not a whole number from 1 up; each removes nothing. A key of another type is an error (WRONGTYPE ...), never an empty answer. In simulation nothing is written: success=true with error NOT_EXECUTED_IN_SIMULATION_MODE. Choosing the positions and removing them is one step, and that step is recorded for a minute under a name of its own: a command the client sends again after a lost reply answers what the first one removed and removes nothing more.
redis zremrangebyrank |
zremrangebyrank |
trim sorted set |
keep newest |
Version history
Introduced in v15.0.3.
Service documentation
External API reference This block wraps a third-party service. Click here for the service's own documentation of the underlying endpoint.Back to
redis Return to the main group to view all sub-groups Back to redis sorted sets Return to the group to view all blocks within this group