Redis的Scala客戶端:rediscala
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() }
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!