rediscalaRedis的Scala客户端

联合创作 · 2023-09-30 19:29

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()
}
浏览 16
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报