Skip to content

Commit 6769e21

Browse files
committed
Added documentation for sort.
1 parent c18fb24 commit 6769e21

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

README.markdown

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,35 @@ $redis->flushAll();
11031103
</pre>
11041104

11051105
## sort
1106-
Documentation for this method will be added shortly.
1106+
##### *Description*
1107+
##### *Parameters*
1108+
*Key*: key
1109+
*Options*: array(key => value, ...) - optional, with the following keys and values:
1110+
<pre>
1111+
'by' => 'some_pattern_*',
1112+
'limit' => array(0, 1),
1113+
'get' => 'some_other_pattern_*',
1114+
'sort' => 'asc' or 'desc',
1115+
'alpha' => TRUE,
1116+
'store' => 'external-key'
1117+
</pre>
1118+
##### *Return value*
1119+
An array of values, or a number corresponding to the number of elements stored if that was used.
1120+
1121+
##### *Example*
1122+
<pre>
1123+
$redis->delete('s');
1124+
$redis->sadd('s', 5);
1125+
$redis->sadd('s', 4);
1126+
$redis->sadd('s', 2);
1127+
$redis->sadd('s', 1);
1128+
$redis->sadd('s', 3);
1129+
1130+
var_dump($redis->sort('s')); // 1,2,3,4,5
1131+
var_dump($redis->sort('s', array('sort' => 'desc'))); // 5,4,3,2,1
1132+
var_dump($redis->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)5
1133+
</pre>
1134+
11071135

11081136
## info
11091137
##### *Description*

0 commit comments

Comments
 (0)