@@ -39,7 +39,8 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
39
39
* @return
40
40
* A three-element Chunk with the first element being the name of the key where a member was popped, the second
41
41
* element is the popped member itself, and the third element is the score of the popped element. An empty chunk is
42
- * returned when no element could be popped and the timeout expired.
42
+ * returned when no element could be popped and the timeout expired. Double.PositiveInfinity and
43
+ * Double.NegativeInfinity are valid scores as well.
43
44
*/
44
45
final def bzPopMax [K : Schema ](
45
46
timeout : Duration ,
@@ -49,7 +50,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
49
50
new ResultBuilder1 [({ type lambda [x] = Option [(K , MemberScore [x])] })# lambda, G ] {
50
51
def returning [M : Schema ]: G [Option [(K , MemberScore [M ])]] = {
51
52
val memberScoreOutput =
52
- Tuple3Output (ArbitraryOutput [K ](), ArbitraryOutput [M ](), DoubleOutput ).map { case (k, m, s) =>
53
+ Tuple3Output (ArbitraryOutput [K ](), ArbitraryOutput [M ](), DoubleOrInfinity ).map { case (k, m, s) =>
53
54
(k, MemberScore (m, s))
54
55
}
55
56
@@ -76,7 +77,8 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
76
77
* @return
77
78
* A three-element Chunk with the first element being the name of the key where a member was popped, the second
78
79
* element is the popped member itself, and the third element is the score of the popped element. An empty chunk is
79
- * returned when no element could be popped and the timeout expired.
80
+ * returned when no element could be popped and the timeout expired. Double.PositiveInfinity and
81
+ * Double.NegativeInfinity are valid scores as well.
80
82
*/
81
83
final def bzPopMin [K : Schema ](
82
84
timeout : Duration ,
@@ -86,7 +88,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
86
88
new ResultBuilder1 [({ type lambda [x] = Option [(K , MemberScore [x])] })# lambda, G ] {
87
89
def returning [M : Schema ]: G [Option [(K , MemberScore [M ])]] = {
88
90
val memberScoreOutput =
89
- Tuple3Output (ArbitraryOutput [K ](), ArbitraryOutput [M ](), DoubleOutput ).map { case (k, m, s) =>
91
+ Tuple3Output (ArbitraryOutput [K ](), ArbitraryOutput [M ](), DoubleOrInfinity ).map { case (k, m, s) =>
90
92
(k, MemberScore (m, s))
91
93
}
92
94
@@ -248,7 +250,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
248
250
NonEmptyList (ArbitraryKeyInput [K ]()),
249
251
WithScoresInput
250
252
),
251
- ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOutput )
253
+ ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOrInfinity )
252
254
.map(_.map { case (m, s) => MemberScore (m, s) })
253
255
)
254
256
command.run((keys.size + 1 , (key, keys.toList), WithScores ))
@@ -366,7 +368,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
366
368
OptionalInput (WeightsInput ),
367
369
WithScoresInput
368
370
),
369
- ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOutput )
371
+ ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOrInfinity )
370
372
.map(_.map { case (m, s) => MemberScore (m, s) })
371
373
)
372
374
command.run((keys.size + 1 , (key, keys.toList), aggregate, weights, WithScores ))
@@ -437,10 +439,11 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
437
439
* Keys of the rest sets
438
440
* @return
439
441
* List of scores or None associated with the specified member values (a double precision floating point number).
442
+ * Double.PositiveInfinity and Double.NegativeInfinity are valid scores as well.
440
443
*/
441
444
final def zMScore [K : Schema ](key : K , keys : K * ): G [Chunk [Option [Double ]]] = {
442
445
val command =
443
- RedisCommand (ZMScore , NonEmptyList (ArbitraryKeyInput [K ]()), ChunkOutput (OptionalOutput (DoubleOutput )))
446
+ RedisCommand (ZMScore , NonEmptyList (ArbitraryKeyInput [K ]()), ChunkOutput (OptionalOutput (DoubleOrInfinity )))
444
447
command.run((key, keys.toList))
445
448
}
446
449
@@ -462,7 +465,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
462
465
val command = RedisCommand (
463
466
ZPopMax ,
464
467
Tuple2 (ArbitraryKeyInput [K ](), OptionalInput (LongInput )),
465
- ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOutput )
468
+ ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOrInfinity )
466
469
.map(_.map { case (m, s) => MemberScore (m, s) })
467
470
)
468
471
command.run((key, count))
@@ -487,7 +490,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
487
490
val command = RedisCommand (
488
491
ZPopMin ,
489
492
Tuple2 (ArbitraryKeyInput [K ](), OptionalInput (LongInput )),
490
- ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOutput )
493
+ ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOrInfinity )
491
494
.map(_.map { case (m, s) => MemberScore (m, s) })
492
495
)
493
496
command.run((key, count))
@@ -550,7 +553,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
550
553
val command = RedisCommand (
551
554
ZRandMember ,
552
555
Tuple3 (ArbitraryKeyInput [K ](), LongInput , WithScoresInput ),
553
- ZRandMemberTuple2Output (ArbitraryOutput [M ](), DoubleOutput )
556
+ ZRandMemberTuple2Output (ArbitraryOutput [M ](), DoubleOrInfinity )
554
557
.map(_.map { case (m, s) => MemberScore (m, s) })
555
558
)
556
559
@@ -593,7 +596,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
593
596
val command = RedisCommand (
594
597
ZRange ,
595
598
Tuple3 (ArbitraryKeyInput [K ](), RangeInput , WithScoresInput ),
596
- ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOutput )
599
+ ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOrInfinity )
597
600
.map(_.map { case (m, s) => MemberScore (m, s) })
598
601
)
599
602
command.run((key, range, WithScores ))
@@ -693,7 +696,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
693
696
WithScoresInput ,
694
697
OptionalInput (LimitInput )
695
698
),
696
- ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOutput )
699
+ ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOrInfinity )
697
700
.map(_.map { case (m, s) => MemberScore (m, s) })
698
701
)
699
702
command.run((key, scoreRange.min.asString, scoreRange.max.asString, WithScores , limit))
@@ -735,7 +738,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
735
738
RedisCommand (
736
739
ZRank ,
737
740
Tuple3 (ArbitraryKeyInput [K ](), ArbitraryValueInput [M ](), WithScoreInput ),
738
- OptionalOutput (Tuple2Output (LongOutput , DoubleOutput ).map { case (r, s) => RankScore (r, s) })
741
+ OptionalOutput (Tuple2Output (LongOutput , DoubleOrInfinity ).map { case (r, s) => RankScore (r, s) })
739
742
)
740
743
command.run((key, member, WithScore ))
741
744
}
@@ -849,7 +852,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
849
852
val command = RedisCommand (
850
853
ZRevRange ,
851
854
Tuple3 (ArbitraryKeyInput [K ](), RangeInput , WithScoresInput ),
852
- ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOutput )
855
+ ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOrInfinity )
853
856
.map(_.map { case (m, s) => MemberScore (m, s) })
854
857
)
855
858
command.run((key, range, WithScores ))
@@ -953,7 +956,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
953
956
WithScoresInput ,
954
957
OptionalInput (LimitInput )
955
958
),
956
- ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOutput )
959
+ ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOrInfinity )
957
960
.map(_.map { case (m, s) => MemberScore (m, s) })
958
961
)
959
962
command.run((key, scoreRange.max.asString, scoreRange.min.asString, WithScores , limit))
@@ -993,7 +996,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
993
996
val command = RedisCommand (
994
997
ZRevRank ,
995
998
Tuple3 (ArbitraryKeyInput [K ](), ArbitraryValueInput [M ](), WithScoreInput ),
996
- OptionalOutput (Tuple2Output (LongOutput , DoubleOutput ).map { case (r, s) => RankScore (r, s) })
999
+ OptionalOutput (Tuple2Output (LongOutput , DoubleOrInfinity ).map { case (r, s) => RankScore (r, s) })
997
1000
)
998
1001
command.run((key, member, WithScore ))
999
1002
}
@@ -1021,7 +1024,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
1021
1024
new ResultBuilder1 [({ type lambda [x] = (Long , MemberScores [x]) })# lambda, G ] {
1022
1025
def returning [M : Schema ]: G [(Long , Chunk [MemberScore [M ]])] = {
1023
1026
val memberScoresOutput =
1024
- ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOutput ).map(_.map { case (m, s) => MemberScore (m, s) })
1027
+ ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOrInfinity ).map(_.map { case (m, s) => MemberScore (m, s) })
1025
1028
1026
1029
val command =
1027
1030
RedisCommand (
@@ -1042,13 +1045,14 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
1042
1045
* @param member
1043
1046
* Member of sorted set
1044
1047
* @return
1045
- * The score of member (a double precision floating point number.
1048
+ * The score of member (a double precision floating point number).
1049
+ * Double.PositiveInfinity and Double.NegativeInfinity are valid scores as well.
1046
1050
*/
1047
1051
final def zScore [K : Schema , M : Schema ](key : K , member : M ): G [Option [Double ]] = {
1048
1052
val command = RedisCommand (
1049
1053
ZScore ,
1050
1054
Tuple2 (ArbitraryKeyInput [K ](), ArbitraryValueInput [M ]()),
1051
- OptionalOutput (DoubleOutput )
1055
+ OptionalOutput (DoubleOrInfinity )
1052
1056
)
1053
1057
command.run((key, member))
1054
1058
}
@@ -1122,7 +1126,7 @@ trait SortedSets[G[+_]] extends RedisEnvironment[G] {
1122
1126
OptionalInput (AggregateInput ),
1123
1127
WithScoresInput
1124
1128
),
1125
- ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOutput )
1129
+ ChunkTuple2Output (ArbitraryOutput [M ](), DoubleOrInfinity )
1126
1130
.map(_.map { case (m, s) => MemberScore (m, s) })
1127
1131
)
1128
1132
command.run((keys.size + 1 , (key, keys.toList), weights, aggregate, WithScores ))
0 commit comments