in storehaus-core/src/main/scala/com/twitter/storehaus/ShardedStore.scala [46:60]
override def multiGet[T <: (K1, K2)](ks: Set[T]): Map[T, Future[Option[V]]] = {
val prefixMap: Map[K1, Set[K2]] = ks.groupBy { _._1 }.mapValues { _.map { t => t._2 } }
val shards: Map[K1, Future[Option[S]]] = routes.multiGet(prefixMap.keySet)
val ksMap: Map[K1, Future[Map[K2, Future[Option[V]]]]] = shards.map { case (k1, fos) =>
val innerm = fos.map {
case None => Map.empty[K2, Future[Option[V]]]
case Some(s) => s.multiGet(prefixMap(k1))
}
(k1, innerm)
}
// Now construct the result map:
CollectionOps.zipWith(ks) { t =>
ksMap(t._1).flatMap { m2 => m2(t._2) }
}
}