in storehaus-redis/src/main/scala/com/twitter/storehaus/redis/RedisSortedSetStore.scala [123:149]
override def get(k: (Buf, Buf)): Future[Option[Double]] =
client.zScore(k._1, k._2).map(_.map(_.doubleValue()))
/** Partitions a map of multiPut pivoted values into
* a two item tuple of deletes and sets, multimapped
* by a key computed from K1.
*
* This makes partioning deletes and sets for pivoted multiPuts
* easier for stores that can perform batch operations on collections
* of InnerK values keyed by OutterK where V indicates membership
* of InnerK within OutterK.
*
* ( general enough to go into PivotOpts )
*/
def multiPutPartitioned[OutterK, InnerK, K1 <: (OutterK, InnerK), V, IndexK](
kv: Map[K1, Option[V]])(by: K1 => IndexK)
: (Map[IndexK, List[(K1, Option[V])]], Map[IndexK, List[(K1, Option[V])]]) = {
def emptyMap = Map.empty[IndexK, List[(K1, Option[V])]].withDefaultValue(Nil)
((emptyMap, emptyMap) /: kv) {
case ((deleting, storing), (key, value @ Some(_))) =>
val index = by(key)
(deleting, storing.updated(index, (key, value) :: storing(index)))
case ((deleting, storing), (key, _)) =>
val index = by(key)
(deleting.updated(index, (key, None) :: deleting(index)), storing)
}
}