Skip to content

Commit

Permalink
fixed zrangebyscore with limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Fuquen committed Jul 13, 2011
1 parent 15426f2 commit caa2abf
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main/scala/com/redis/SortedSetOperations.scala
Expand Up @@ -47,8 +47,19 @@ trait SortedSetOperations { self: Redis =>
minInclusive: Boolean = true, minInclusive: Boolean = true,
max: Double = Double.PositiveInfinity, max: Double = Double.PositiveInfinity,
maxInclusive: Boolean = true, maxInclusive: Boolean = true,
limit: Option[(Int, Int)])(implicit format: Format, parse: Parse[A]): Option[List[A]] = 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))
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 // ZRANK
// ZREVRANK // ZREVRANK
Expand Down

0 comments on commit caa2abf

Please sign in to comment.