rediscala 是 Redis 的 Scala 非堵塞客户端开发包,支持异步 I/O 操作。
示例代码:
import redis.RedisClient import scala.concurrent.Await import scala.concurrent.duration._ import scala.concurrent.ExecutionContext.Implicits.global object Main extends App { implicit val akkaSystem = akka.actor.ActorSystem() val redis = RedisClient() val futurePong = redis.ping() println("Ping sent!") futurePong.map(pong => { println(s"Redis replied with a $pong") }) Await.result(futurePong, 5 seconds) akkaSystem.shutdown() }