Skip to content
Browse files

fixed zrangebyscore with limit

  • Loading branch information...
1 parent 15426f2 commit caa2abfd84aa6845f949d9aa1cb9bbc59acd8a3d Edwin Fuquen committed Jul 12, 2011
Showing with 13 additions and 2 deletions.
  1. +13 −2 src/main/scala/com/redis/SortedSetOperations.scala
View
15 src/main/scala/com/redis/SortedSetOperations.scala
@@ -47,8 +47,19 @@ trait SortedSetOperations { self: Redis =>
minInclusive: Boolean = true,
max: Double = Double.PositiveInfinity,
maxInclusive: Boolean = true,
- limit: Option[(Int, Int)])(implicit format: Format, parse: Parse[A]): Option[List[A]] =
- send("ZRANGEBYSCORE", key :: Format.formatDouble(min, minInclusive) :: Format.formatDouble(max, maxInclusive) :: limit.toList.flatMap(l => List(l._1, l._2)))(asList.map(_.flatten))
+ limit: Option[(Int, Int)])(implicit format: Format, parse: Parse[A]): Option[List[A]] = {
+
+ val limitEntries = if(!limit.isEmpty) {
+ "LIMIT" :: limit.toList.flatMap(l => List(l._1, l._2))
+ } else {
+ List()
+ }
+ send("ZRANGEBYSCORE", key ::
+ Format.formatDouble(min, minInclusive) ::
+ Format.formatDouble(max, maxInclusive) ::
+ limitEntries
+ )(asList.map(_.flatten))
+ }
// ZRANK
// ZREVRANK

0 comments on commit caa2abf

Please sign in to comment.
Something went wrong with that request. Please try again.