I'm looking for Redis client implementation for Scala. The client should be async and non-blocking, using Akka futures. What I found more or less useful:
But both of them have their issues. First one uses old version of Akka, which causes compilation issues, second one uses scala.actors.Futures.future instead of Akka futures. I saw a conversation, which took place few months ago: groups.google.com/forum/#!msg/akka-user/EDKA2aTigho/_wWcNIz2O3wJ
But I failed to find any solution. Anyone had something similar?
Thanks for your answers.
Here are a few new Scala Redis libraries that are Reactive (async + non-blocking):
https://github.com/debasishg/scala-redis-nb
https://github.com/etaty/rediscala
https://github.com/Livestream/scredis
scala-redis is currently the best option. While it is a blocking client, some examples of asynchronous patterns are given in the README file. Also note that the library itself does not use scala.actors.Futures.future
; only demo code in the spec (test code) and README does.
If you only need to store a few things in Redis, it's also possible to roll your own Redis client with a Spray.io IOBridge
.
On a sidenote: Akka futures are already in Scala 2.10.0 and scala.actors
is deprecated as of Scala 2.11.0. I'm not sure why scala-redis is using scala.actors
even though it depends on Akka and Scala 2.10.0.
There's a non-blocking client that returns Futures available as the finagle-redis module. Example usage here: https://github.com/twitter/finagle/blob/master/finagle-example/src/main/scala/com/twitter/finagle/example/redis/RedisClient.scala
A caveat: it currently returns Twitter Futures. You can use that to complete the Promise for an Akka Future; an example of that is on the first code example in the slides for Blake's NEScala talk: http://nescala.org/#t-8378162
People at Twitter say they'll have Twitter futures implement the 2.10 Future trait for API compatibility, when they move to 2.10.
The author of scala-redis sounded interested in porting it to use spray-io, in which case it would be non-blocking.
There is also scredis which is a complete, non-blocking and blazing fast Scala Redis client built on top of Akka IO. It is extensively used in production at Livestream.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With