]> git.saurik.com Git - redis.git/blob - doc/ZrangeCommand.html
Fixed missed use of INSTALL_TOP
[redis.git] / doc / ZrangeCommand.html
1
2 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
3 <html>
4 <head>
5 <link type="text/css" rel="stylesheet" href="style.css" />
6 </head>
7 <body>
8 <div id="page">
9
10 <div id='header'>
11 <a href="index.html">
12 <img style="border:none" alt="Redis Documentation" src="redis.png">
13 </a>
14 </div>
15
16 <div id="pagecontent">
17 <div class="index">
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>&nbsp;&nbsp;<a href="#ZRANGE _key_ _start_ _end_ `[`WITHSCORES`]`(Redis &gt;">ZRANGE _key_ _start_ _end_ `[`WITHSCORES`]`(Redis &gt;</a><br>&nbsp;&nbsp;<a href="#ZREVRANGE _key_ _start_ _end_ `[`WITHSCORES`]` (Redis &gt;">ZREVRANGE _key_ _start_ _end_ `[`WITHSCORES`]` (Redis &gt;</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#Return value">Return value</a>
20 </div>
21
22 <h1 class="wikiname">ZrangeCommand</h1>
23
24 <div class="summary">
25
26 </div>
27
28 <div class="narrow">
29 &iuml;&raquo;&iquest;#sidebar <a href="SortedSetCommandsSidebar.html">SortedSetCommandsSidebar</a><h1><a name="ZRANGE _key_ _start_ _end_ `[`WITHSCORES`]`(Redis &gt;">ZRANGE _key_ _start_ _end_ `[`WITHSCORES`]`(Redis &gt;</a></h1> 1.1) =
30 <h1><a name="ZREVRANGE _key_ _start_ _end_ `[`WITHSCORES`]` (Redis &gt;">ZREVRANGE _key_ _start_ _end_ `[`WITHSCORES`]` (Redis &gt;</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">&gt;</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 <blockquote>It's possible to pass the WITHSCORES option to the command in order to return notonly the values but also the scores of the elements. Redis will return the dataas a single list composed of value1,score1,value2,score2,...,valueN,scoreN but clientlibraries are free to return a more appropriate data type (what we think is thatthe best return type for this command is a Array of two-elements Array / Tuple inorder to preserve sorting).</blockquote>
35 <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.
36 </div>
37
38 </div>
39 </div>
40 </body>
41 </html>
42