redis ZREMRANGEBYRANK command


  Translation results:

rem

UK[ˌɑ:r i: ˈem] US[ˌɑ:ri:'em]

n.DOS command: specified by DOS Ignored command line; (sleep) REM

range

UK[reɪndʒ] US[rendʒ]

n.range; Range; Category; Arrangement (of mountains, houses, etc.)

vi. Search; Change; Extend; Roam

vt. Arrange; Sort (in a certain position or order); Classify...; Wandering

adj. Pasture, grazing area

Third person singular: ranges Plural: ranges Present participle: ranging Past tense: ranged Past participle: ranged

by

英[baɪ] 美[baɪ]

prep.beside...;expression method;due to;passing through

adv.passing;meaning to retain or save When used; for a short visit

rank

##英[ræŋk] 美[ræŋk]  

n. Military rank; class, grade; order, sequence; Rank and file

vt.& vi. Arrange, make it horizontal; classify...

vt. Arrange; exceed, be higher than; classify... ;arrange horizontally;complain;find fault, expose wounds

adj.obnoxious;extreme;luxuriant;stinky

Third person singular: ranks plural: ranks present participle: ranking past Formula: ranked Past participle: ranked Comparative: ranker Superlative: rankest

redis ZREMRANGEBYRANK commandsyntax

Function: Remove all members within the specified rank range in the ordered set key.

Syntax: ZREMRANGEBYRANK key start stop

Description: The intervals are indicated by the subscript parameters start and stop respectively, including start and stop. The subscript parameters start and stop are both base 0, that is, 0 represents the first member of the ordered set, 1 represents the second member of the ordered set, and so on. You can also use negative subscripts, with -1 representing the last member, -2 representing the second to last member, and so on.

Available versions: >= 2.0.0

Time complexity: O(log(N) M), N is ordered is the cardinality of the set, and M is the number of removed members.

Returns: The number of removed members.

redis ZREMRANGEBYRANK commandexample

redis> ZADD salary 2000 jack
(integer) 1
redis> ZADD salary 5000 tom
(integer) 1
redis> ZADD salary 3500 peter
(integer) 1
redis> ZREMRANGEBYRANK salary 0 1       # 移除下标 0 至 1 区间内的成员
(integer) 2
redis> ZRANGE salary 0 -1 WITHSCORES    # 有序集只剩下一个成员
1) "tom"
2) "5000"

Home

Videos

Q&A