31
31
import org .springframework .data .redis .connection .ReactiveRedisConnection .CommandResponse ;
32
32
import org .springframework .data .redis .connection .ReactiveRedisConnection .KeyCommand ;
33
33
import org .springframework .data .redis .connection .ReactiveRedisConnection .KeyScanCommand ;
34
+ import org .springframework .data .redis .connection .ReactiveRedisConnection .MultiValueResponse ;
34
35
import org .springframework .data .redis .connection .ReactiveRedisConnection .NumericResponse ;
35
36
import org .springframework .data .redis .connection .RedisZSetCommands .Aggregate ;
36
37
import org .springframework .data .redis .connection .RedisZSetCommands .Limit ;
@@ -292,7 +293,7 @@ private ZRemCommand(@Nullable ByteBuffer key, List<ByteBuffer> values) {
292
293
* Creates a new {@link ZRemCommand} given a {@link Tuple}.
293
294
*
294
295
* @param value must not be {@literal null}.
295
- * @return a new {@link ZAddCommand } for {@link Tuple}.
296
+ * @return a new {@link ZRemCommand } for {@link Tuple}.
296
297
*/
297
298
public static ZRemCommand values (ByteBuffer value ) {
298
299
@@ -305,7 +306,7 @@ public static ZRemCommand values(ByteBuffer value) {
305
306
* Creates a new {@link ZRemCommand} given a {@link Collection} of {@link Tuple}.
306
307
*
307
308
* @param values must not be {@literal null}.
308
- * @return a new {@link ZAddCommand } for {@link Tuple}.
309
+ * @return a new {@link ZRemCommand } for {@link Tuple}.
309
310
*/
310
311
public static ZRemCommand values (Collection <ByteBuffer > values ) {
311
312
@@ -1283,7 +1284,7 @@ private ZScoreCommand(@Nullable ByteBuffer key, ByteBuffer value) {
1283
1284
* Creates a new {@link ZScoreCommand} given a {@link ByteBuffer member}.
1284
1285
*
1285
1286
* @param member must not be {@literal null}.
1286
- * @return a new {@link ZScoreCommand} for {@link Range }.
1287
+ * @return a new {@link ZScoreCommand} for {@link ByteBuffer member }.
1287
1288
*/
1288
1289
public static ZScoreCommand scoreOf (ByteBuffer member ) {
1289
1290
@@ -1339,6 +1340,99 @@ default Mono<Double> zScore(ByteBuffer key, ByteBuffer value) {
1339
1340
*/
1340
1341
Flux <NumericResponse <ZScoreCommand , Double >> zScore (Publisher <ZScoreCommand > commands );
1341
1342
1343
+ /**
1344
+ * {@code ZMSCORE} command parameters.
1345
+ *
1346
+ * @author Mark Paluch
1347
+ * @see <a href="https://redis.io/commands/zmscore">Redis Documentation: ZMSCORE</a>
1348
+ * @since 2.6
1349
+ */
1350
+ class ZMScoreCommand extends KeyCommand {
1351
+
1352
+ private final Collection <ByteBuffer > values ;
1353
+
1354
+ private ZMScoreCommand (@ Nullable ByteBuffer key , Collection <ByteBuffer > values ) {
1355
+
1356
+ super (key );
1357
+
1358
+ this .values = values ;
1359
+ }
1360
+
1361
+ /**
1362
+ * Creates a new {@link ZMScoreCommand} given a {@link ByteBuffer member}.
1363
+ *
1364
+ * @param member must not be {@literal null}.
1365
+ * @return a new {@link ZMScoreCommand} for {@link ByteBuffer}.
1366
+ */
1367
+ public static ZMScoreCommand scoreOf (ByteBuffer member ) {
1368
+
1369
+ Assert .notNull (member , "Member must not be null!" );
1370
+
1371
+ return new ZMScoreCommand (null , Collections .singletonList (member ));
1372
+ }
1373
+
1374
+ /**
1375
+ * Creates a new {@link ZMScoreCommand} given a {@link List members}.
1376
+ *
1377
+ * @param member must not be {@literal null}.
1378
+ * @return a new {@link ZMScoreCommand} for {@link List} of members.
1379
+ */
1380
+ public static ZMScoreCommand scoreOf (Collection <ByteBuffer > members ) {
1381
+
1382
+ Assert .notNull (members , "Members must not be null!" );
1383
+
1384
+ return new ZMScoreCommand (null , members );
1385
+ }
1386
+
1387
+ /**
1388
+ * Applies the {@literal key}. Constructs a new command instance with all previously configured properties.
1389
+ *
1390
+ * @param key must not be {@literal null}.
1391
+ * @return a new {@link ZMScoreCommand} with {@literal key} applied.
1392
+ */
1393
+ public ZMScoreCommand forKey (ByteBuffer key ) {
1394
+
1395
+ Assert .notNull (key , "Key must not be null!" );
1396
+
1397
+ return new ZMScoreCommand (key , values );
1398
+ }
1399
+
1400
+ /**
1401
+ * @return
1402
+ */
1403
+ public Collection <ByteBuffer > getValues () {
1404
+ return values ;
1405
+ }
1406
+ }
1407
+
1408
+ /**
1409
+ * Get the scores of elements with {@literal values} from sorted set with key {@literal key}.
1410
+ *
1411
+ * @param key must not be {@literal null}.
1412
+ * @param values must not be {@literal null}.
1413
+ * @return
1414
+ * @see <a href="https://redis.io/commands/zmscore">Redis Documentation: ZMSCORE</a>
1415
+ * @since 2.6
1416
+ */
1417
+ default Mono <List <Double >> zMScore (ByteBuffer key , Collection <ByteBuffer > values ) {
1418
+
1419
+ Assert .notNull (key , "Key must not be null!" );
1420
+ Assert .notNull (values , "Values must not be null!" );
1421
+
1422
+ return zMScore (Mono .just (ZMScoreCommand .scoreOf (values ).forKey (key ))).next ().map (MultiValueResponse ::getOutput );
1423
+ }
1424
+
1425
+ /**
1426
+ * Get the scores of elements with {@link ZMScoreCommand#getValues()} from sorted set with key
1427
+ * {@link ZMScoreCommand#getKey()}
1428
+ *
1429
+ * @param commands must not be {@literal null}.
1430
+ * @return
1431
+ * @see <a href="https://redis.io/commands/zmscore">Redis Documentation: ZMSCORE</a>
1432
+ * @since 2.6
1433
+ */
1434
+ Flux <MultiValueResponse <ZMScoreCommand , Double >> zMScore (Publisher <ZMScoreCommand > commands );
1435
+
1342
1436
/**
1343
1437
* {@code ZREMRANGEBYRANK} command parameters.
1344
1438
*
@@ -1787,7 +1881,7 @@ private ZInterStoreCommand(ByteBuffer key, List<ByteBuffer> sourceKeys, List<Dou
1787
1881
* Creates a new {@link ZInterStoreCommand} given a {@link List} of keys.
1788
1882
*
1789
1883
* @param keys must not be {@literal null}.
1790
- * @return a new {@link ZInterStoreCommand} for {@link Range} .
1884
+ * @return a new {@link ZInterStoreCommand} for {@link List} of keys .
1791
1885
*/
1792
1886
public static ZInterStoreCommand sets (List <ByteBuffer > keys ) {
1793
1887
0 commit comments