@@ -1044,22 +1044,32 @@ public function sPop( $key ) {}
1044
1044
1045
1045
1046
1046
/**
1047
- * Returns a random element from the set value at Key, without removing it.
1047
+ * Returns a random element(s) from the set value at Key, without removing it.
1048
1048
*
1049
- * @param string $key
1050
- * @return string value from the set
1051
- * bool FALSE if set identified by key is empty or doesn't exist.
1049
+ * @param string $key
1050
+ * @param int $count [optional]
1051
+ * @return string|array value(s) from the set
1052
+ * bool FALSE if set identified by key is empty or doesn't exist and count argument isn't passed.
1052
1053
* @link http://redis.io/commands/srandmember
1053
1054
* @example
1054
1055
* <pre>
1055
- * $redis->sAdd('key1' , 'set1');
1056
- * $redis->sAdd('key1' , 'set2');
1057
- * $redis->sAdd('key1' , 'set3'); // 'key1' => {'set3', 'set1', 'set2'}
1058
- * $redis->sRandMember('key1'); // 'set1', 'key1' => {'set3', 'set1', 'set2'}
1059
- * $redis->sRandMember('key1'); // 'set3', 'key1' => {'set3', 'set1', 'set2'}
1056
+ * $redis->sAdd('key1' , 'one');
1057
+ * $redis->sAdd('key1' , 'two');
1058
+ * $redis->sAdd('key1' , 'three'); // 'key1' => {'one', 'two', 'three'}
1059
+ *
1060
+ * var_dump( $redis->sRandMember('key1') ); // 'key1' => {'one', 'two', 'three'}
1061
+ *
1062
+ * // string(5) "three"
1063
+ *
1064
+ * var_dump( $redis->sRandMember('key1', 2) ); // 'key1' => {'one', 'two', 'three'}
1065
+ *
1066
+ * // array(2) {
1067
+ * // [0]=> string(2) "one"
1068
+ * // [1]=> string(2) "three"
1069
+ * // }
1060
1070
* </pre>
1061
1071
*/
1062
- public function sRandMember ( $ key ) {}
1072
+ public function sRandMember ( $ key, $ count = null ) {}
1063
1073
1064
1074
/**
1065
1075
* Returns the members of a set resulting from the intersection of all the sets
0 commit comments