1
我正在尝试使用Scala-Redis连接器。这是建立连接的代码。scala-redis连接器中的模糊隐式值
object RedisConnection extends Serializable {
lazy val r: RedisClient = new RedisClient("localhost", 6379,5)
}
我以这种方式定义了连接,因为我得到了“task not serialisable error”。 当我做println(RedisConnection.r.get("microcin b17"))
,我有以下错误,试图做SBT装配
ambiguous implicit values:
[error] both value parseString in object Implicits of type => com.redis.serialization.Parse[String]
[error] and value parseByteArray in object Implicits of type => com.redis.serialization.Parse[Array[Byte]]
[error] match expected type com.redis.serialization.Parse[A]
任何帮助,将不胜感激的时候。谢谢。
您是否尝试过指定正是你想要的类型的类型? r.get [String](“microcin b17”) – mavarazy
谢谢。这似乎工作。 –
好吧,我会将它作为回答发布:) – mavarazy