2 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN">
5 <link type=
"text/css" rel=
"stylesheet" href=
"style.css" />
12 <img style=
"border:none" alt=
"Redis Documentation" src=
"redis.png">
16 <div id=
"pagecontent">
18 <!-- This is a (PRE) block. Make sure it's left aligned or your toc title will be off. -->
19 <b>ZrangeCommand: Contents
</b><br> <a href=
"#ZRANGE _key_ _start_ _end_ (Redis >">ZRANGE _key_ _start_ _end_ (Redis
></a><br> <a href=
"#ZREVRANGE _key_ _start_ _end_ (Redis >">ZREVRANGE _key_ _start_ _end_ (Redis
></a><br> <a href=
"#Return value">Return value
</a>
22 <h1 class=
"wikiname">ZrangeCommand
</h1>
29 #sidebar
<a href=
"SortedSetCommandsSidebar.html">SortedSetCommandsSidebar
</a><h1><a name=
"ZRANGE _key_ _start_ _end_ (Redis >">ZRANGE _key_ _start_ _end_ (Redis
></a></h1> 1.1) =
30 <h1><a name=
"ZREVRANGE _key_ _start_ _end_ (Redis >">ZREVRANGE _key_ _start_ _end_ (Redis
></a></h1> 1.1) =
31 <i>Time complexity: O(log(N))+O(M) (with N being the number of elements in the sorted set and M the number of elements requested)
</i><blockquote>Return the specified elements of the sorted set at the specifiedkey. The elements are considered sorted from the lowerest to the highestscore when using ZRANGE, and in the reverse order when using ZREVRANGE.Start and end are zero-based indexes.
0 is the first elementof the sorted set (the one with the lowerest score when using ZRANGE),
1the next element by score and so on.
</blockquote>
32 <blockquote>_start_ and
<i>end
</i> can also be negative numbers indicating offsetsfrom the end of the sorted set. For example -
1 is the last element ofthe sorted set, -
2 the penultimate element and so on.
</blockquote>
33 <blockquote>Indexes out of range will not produce an error: if start is overthe end of the sorted set, or start
<code name=
"code" class=
"python">></code> end, an empty list is returned.If end is over the end of the sorted set Redis will threat it just likethe last element of the sorted set.
</blockquote>
34 <h2><a name=
"Return value">Return value
</a></h2><a href=
"ReplyTypes.html">Multi bulk reply
</a>, specifically a list of elements in the specified range.