1 | <?php |
||
7 | trait SortedSets |
||
8 | { |
||
9 | /* |
||
10 | * Available Set Operations |
||
11 | */ |
||
12 | protected $SET_OPERATIONS = ['SUM', 'MIN', 'MAX']; |
||
13 | |||
14 | public function bzPop(): bool |
||
18 | |||
19 | /** |
||
20 | * Add one or more members to a sorted set or update its score if it |
||
21 | * already exists. |
||
22 | * |
||
23 | * See: https://redis.io/commands/zadd. |
||
24 | * |
||
25 | * @param string $key |
||
26 | * @param float $score |
||
27 | * @param mixed] $member |
||
|
|||
28 | * |
||
29 | * @return int 1 if the element is added. 0 otherwise. |
||
30 | */ |
||
31 | public function zAdd(string $key, float $score, $member): int |
||
35 | |||
36 | /** |
||
37 | * Get the number of members in a sorted set. |
||
38 | * See: https://redis.io/commands/zcard. |
||
39 | * |
||
40 | * @param string $key |
||
41 | * |
||
42 | * @return int The Set's cardinality |
||
43 | */ |
||
44 | public function zCard(string $key): int |
||
48 | |||
49 | /** |
||
50 | * Get the number of members in a sorted set. |
||
51 | * |
||
52 | * Note: zSize is an alias for zCard and will be removed in future |
||
53 | * versions of phpredis. |
||
54 | * |
||
55 | * See: https://redis.io/commands/zcard. |
||
56 | * |
||
57 | * @param string $key |
||
58 | * |
||
59 | * @return int The Set's cardinality |
||
60 | */ |
||
61 | public function zSize(string $key): int |
||
65 | |||
66 | /** |
||
67 | * Returns the number of elements of the sorted set stored at the specified |
||
68 | * key which have scores in the range [start, end]. Adding a parenthesis |
||
69 | * before start or end excludes it from the range. +inf and -inf are also |
||
70 | * valid limits. |
||
71 | * |
||
72 | * See: https://redis.io/commands/zcount. |
||
73 | * |
||
74 | * @param string $key |
||
75 | * @param mixed|int|string $start |
||
76 | * @param mixed|int|string $end |
||
77 | * |
||
78 | * @return int the size of a corresponding zRangeByScore. |
||
79 | */ |
||
80 | public function zCount(string $key, $start, $end): int |
||
84 | |||
85 | /** |
||
86 | * Increments the score of a member from a sorted set by a given amount. |
||
87 | * |
||
88 | * See: https://redis.io/commands/zincrby. |
||
89 | * |
||
90 | * @param string $key |
||
91 | * @param float $value (double) value that will be added to the |
||
92 | * member's score). |
||
93 | * @param string $member |
||
94 | * |
||
95 | * @return float the new value |
||
96 | */ |
||
97 | public function zIncrBy(string $key, float $value, $member): float |
||
101 | |||
102 | /** |
||
103 | * Creates an intersection of sorted sets given in second argument. |
||
104 | * The result of the union will be stored in the sorted set defined by the |
||
105 | * first argument. |
||
106 | * |
||
107 | * The third optional argument defines weights to apply to the sorted sets |
||
108 | * in input. In this case, the weights will be multiplied by the score of |
||
109 | * each element in the sorted set before applying the aggregation. The |
||
110 | * forth argument defines the AGGREGATE option which specify how the |
||
111 | * results of the union are aggregated. |
||
112 | * |
||
113 | * See: https://redis.io/commands/zinterstore. |
||
114 | * |
||
115 | * @param string $keyOutput |
||
116 | * @param array $arrayZSetKeys |
||
117 | * @param array $arrayWeights |
||
118 | * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": |
||
119 | * defines the behaviour to use on |
||
120 | * duplicate entries during the |
||
121 | * zInterStore. |
||
122 | * |
||
123 | * @return int The number of values in the new |
||
124 | * sorted set. |
||
125 | */ |
||
126 | public function zInterStore( |
||
151 | |||
152 | /** |
||
153 | * Creates an intersection of sorted sets given in second argument. |
||
154 | * The result of the union will be stored in the sorted set defined by the |
||
155 | * first argument. |
||
156 | * |
||
157 | * The third optional argument defines weights to apply to the sorted sets |
||
158 | * in input. In this case, the weights will be multiplied by the score of |
||
159 | * each element in the sorted set before applying the aggregation. The |
||
160 | * forth argument defines the AGGREGATE option which specify how the |
||
161 | * results of the union are aggregated. |
||
162 | * |
||
163 | * Note: zInter is an alias for zinterstore and will be removed in future |
||
164 | * versions of phpredis. |
||
165 | * |
||
166 | * See: https://redis.io/commands/zinterstore. |
||
167 | * |
||
168 | * @param string $keyOutput |
||
169 | * @param array $arrayZSetKeys |
||
170 | * @param array $arrayWeights |
||
171 | * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": |
||
172 | * defines the behaviour to use on |
||
173 | * duplicate entries during the |
||
174 | * zInterStore. |
||
175 | * |
||
176 | * @return int The number of values in the new |
||
177 | * sorted set. |
||
178 | */ |
||
179 | public function zInter( |
||
204 | |||
205 | /** |
||
206 | * Can pop the highest or lowest scoring members from one ZSETs. |
||
207 | * There are two commands (ZPOPMIN and ZPOPMAX for popping the lowest and |
||
208 | * highest scoring elements respectively.). |
||
209 | * |
||
210 | * See: https://redis.io/commands/zpopmin. |
||
211 | * See: https://redis.io/commands/zpopmax. |
||
212 | * |
||
213 | * @param string $key |
||
214 | * @param int|integer $count |
||
215 | * @param bool|boolean $max |
||
216 | * |
||
217 | * @return array Either an array with the key member and |
||
218 | * score of the highest or lowest element |
||
219 | * or an empty array if there is no element |
||
220 | * available. |
||
221 | */ |
||
222 | public function zPop(string $key, int $count = 1, bool $max = true): array |
||
226 | |||
227 | /** |
||
228 | * Can pop the lowest scoring members from one ZSETs. |
||
229 | * |
||
230 | * See: https://redis.io/commands/zpopmin. |
||
231 | * |
||
232 | * @param string $key |
||
233 | * @param int|integer $count |
||
234 | * |
||
235 | * @return array Either an array with the key member and |
||
236 | * score of the highest or lowest element |
||
237 | * or an empty array if there is no element |
||
238 | * available. |
||
239 | */ |
||
240 | public function zPopMin(string $key, int $count = 1): array |
||
244 | |||
245 | /** |
||
246 | * Can pop the highest scoring members from one ZSETs. |
||
247 | * |
||
248 | * See: https://redis.io/commands/zpopmax. |
||
249 | * |
||
250 | * @param string $key |
||
251 | * @param int|integer $count |
||
252 | * |
||
253 | * @return array Either an array with the key member and |
||
254 | * score of the highest or lowest element |
||
255 | * or an empty array if there is no element |
||
256 | * available. |
||
257 | */ |
||
258 | public function zPopMax(string $key, int $count = 1): array |
||
262 | |||
263 | /** |
||
264 | * Returns a range of elements from the ordered set stored at the specified |
||
265 | * key, with values in the range [start, end]. |
||
266 | * |
||
267 | * Start and stop are interpreted as zero-based indices: |
||
268 | * 0 the first element, 1 the second ... |
||
269 | * -1 the last element, -2 the penultimate ... |
||
270 | * |
||
271 | * See: https://redis.io/commands/zrange. |
||
272 | * |
||
273 | * @param string $key |
||
274 | * @param int|integer $start |
||
275 | * @param int|integer $end |
||
276 | * @param bool|boolean $withScores |
||
277 | * |
||
278 | * @return array Array containing the values in specified range. |
||
279 | */ |
||
280 | public function zRange(string $key, int $start = 0, int $end = -1, bool $withScores = false): array |
||
284 | |||
285 | public function zRangeByScore(): bool |
||
289 | |||
290 | public function zRevRangeByScore(): bool |
||
294 | |||
295 | public function zRangeByLex(): bool |
||
299 | |||
300 | public function zRank(): bool |
||
304 | |||
305 | public function zRevRank(): bool |
||
309 | |||
310 | public function zRem(): bool |
||
314 | |||
315 | public function zDelete(): bool |
||
319 | |||
320 | public function zRemove(): bool |
||
324 | |||
325 | public function zRemRangeByRank(): bool |
||
329 | |||
330 | public function zDeleteRangeByRank(): bool |
||
334 | |||
335 | public function zRemRangeByScore(): bool |
||
339 | |||
340 | public function zDeleteRangeByScore(): bool |
||
344 | |||
345 | public function zRemoveRangeByScore(): bool |
||
349 | |||
350 | public function zRevRange(): bool |
||
354 | |||
355 | public function zScore(): bool |
||
359 | |||
360 | public function zunionstore(): bool |
||
364 | |||
365 | public function zUnion(): bool |
||
369 | |||
370 | public function zScan(): bool |
||
374 | } |
||
375 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.