@@ -1444,6 +1444,82 @@ default Mono<Long> zRemRangeByScore(ByteBuffer key, Range<Double> range) {
1444
1444
*/
1445
1445
Flux <NumericResponse <ZRemRangeByScoreCommand , Long >> zRemRangeByScore (Publisher <ZRemRangeByScoreCommand > commands );
1446
1446
1447
+ /**
1448
+ * {@code ZREMRANGEBYLEX} command parameters.
1449
+ *
1450
+ * @author Christoph Strobl
1451
+ * @since 2.5
1452
+ * @see <a href="https://redis.io/commands/zremrangebylex">Redis Documentation: ZREMRANGEBYLEX</a>
1453
+ */
1454
+ class ZRemRangeByLexCommand extends KeyCommand {
1455
+
1456
+ private final Range <String > range ;
1457
+
1458
+ private ZRemRangeByLexCommand (@ Nullable ByteBuffer key , Range <String > range ) {
1459
+
1460
+ super (key );
1461
+ this .range = range ;
1462
+ }
1463
+
1464
+ /**
1465
+ * Creates a new {@link ZRemRangeByLexCommand} given a {@link Range}.
1466
+ *
1467
+ * @param range must not be {@literal null}.
1468
+ * @return a new {@link ZRemRangeByScoreCommand} for {@link Range}.
1469
+ */
1470
+ public static ZRemRangeByLexCommand lexWithin (Range <String > range ) {
1471
+ return new ZRemRangeByLexCommand (null , range );
1472
+ }
1473
+
1474
+ /**
1475
+ * Applies the {@literal key}. Constructs a new command instance with all previously configured properties.
1476
+ *
1477
+ * @param key must not be {@literal null}.
1478
+ * @return a new {@link ZRemRangeByLexCommand} with {@literal key} applied.
1479
+ */
1480
+ public ZRemRangeByLexCommand from (ByteBuffer key ) {
1481
+
1482
+ Assert .notNull (key , "Key must not be null!" );
1483
+
1484
+ return new ZRemRangeByLexCommand (key , range );
1485
+ }
1486
+
1487
+ /**
1488
+ * @return
1489
+ */
1490
+ public Range <String > getRange () {
1491
+ return range ;
1492
+ }
1493
+ }
1494
+
1495
+ /**
1496
+ * Remove elements in {@link Range} from sorted set with {@literal key}.
1497
+ *
1498
+ * @param key must not be {@literal null}.
1499
+ * @param range must not be {@literal null}.
1500
+ * @return a {@link Mono} emitting the number of removed elements.
1501
+ * @since 2.5
1502
+ * @see <a href="https://redis.io/commands/zremrangebylex">Redis Documentation: ZREMRANGEBYLEX</a>
1503
+ */
1504
+ default Mono <Long > zRemRangeByLex (ByteBuffer key , Range <String > range ) {
1505
+
1506
+ Assert .notNull (key , "Key must not be null!" );
1507
+ Assert .notNull (range , "Range must not be null!" );
1508
+
1509
+ return zRemRangeByLex (Mono .just (ZRemRangeByLexCommand .lexWithin (range ).from (key ))).next ()
1510
+ .map (NumericResponse ::getOutput );
1511
+ }
1512
+
1513
+ /**
1514
+ * Remove elements in {@link Range} from sorted set with {@link ZRemRangeByLexCommand#getKey()}.
1515
+ *
1516
+ * @param commands must not be {@literal null}.
1517
+ * @return
1518
+ * @since 2.5
1519
+ * @see <a href="https://redis.io/commands/zremrangebylex">Redis Documentation: ZREMRANGEBYLEX</a>
1520
+ */
1521
+ Flux <NumericResponse <ZRemRangeByLexCommand , Long >> zRemRangeByLex (Publisher <ZRemRangeByLexCommand > commands );
1522
+
1447
1523
/**
1448
1524
* {@code ZUNIONSTORE} command parameters.
1449
1525
*
0 commit comments