scala-redis icon indicating copy to clipboard operation
scala-redis copied to clipboard

evalSHA with script the returns String

Open sdale511 opened this issue 8 years ago • 7 comments

Seems to be an issue with evalSHA returning a simple string.

The loaded script should return "foo", but instead returns "[B@7574e223".

The following is run against the head of the master branch:

scala> import com.redis._ import com.redis._

scala> val r = new RedisClient("localhost", 6379) r: com.redis.RedisClient = localhost:6379

scala> r.scriptLoad("return 'foo'").get res0: String = 6dcea60f8ec363f0f04e8bc9cbb06f23add0b470

scala> r.evalSHA("6dcea60f8ec363f0f04e8bc9cbb06f23add0b470", List(), List()) res1: Option[String] = Some([B@7574e223)

scala> r.evalBulk("return 'foo'", List(), List()) res2: Option[String] = Some(foo)

sdale511 avatar Jan 17 '16 19:01 sdale511

Thanks for reporting .. will look into it ..

debasishg avatar Jan 17 '16 19:01 debasishg

Had a look today into this. Looks like the fix for https://github.com/debasishg/scala-redis/issues/128 did only solve the issue partially. It fixed for integers but broke others. In fact having a generic fix will take some time as the conversion between Redis and Lua data types are quite involved. See http://redis.io/commands/eval for details. I need some time to work on this fix. I am right now tied up with commitments and will be traveling for conferences next week. Will be back in first week of Feb and will fix it after that. Meanwhile if someone can look into it and have a PR, I can take a look.

debasishg avatar Jan 24 '16 16:01 debasishg

Thanks - we are in the middle of a global release and I have a workaround for now.  If my list clears up before next week week I’ll take a deeper look.

Appreciate the effort (and library). --  Scott Dale

On January 24, 2016 at 8:26:26 AM, Debasish Ghosh ([email protected]) wrote:

Had a look today into this. Looks like the fix for #128 did only solve the issue partially. It fixed for integers but broke others. In fact having a generic fix will take some time as the conversion between Redis and Lua data types are quite involved. See http://redis.io/commands/eval for details. I need some time to work on this fix. I am right now tied up with commitments and will be traveling for conferences next week. Will be back in first week of Feb and will fix it after that. Meanwhile if someone can look into it and have a PR, I can take a look.

— Reply to this email directly or view it on GitHub.

sdale511 avatar Jan 25 '16 17:01 sdale511

found some time last evening and started working on a branch .. have a look at this commit .. https://github.com/debasishg/scala-redis/commit/c040f223ad46d05ce779b17803348d17e43a743a .. now works with String, Int etc. from Lua. But the API for evalSHA is now less typed. Will continue to work when I get bits of time ..

debasishg avatar Jan 25 '16 17:01 debasishg

We have put this branch into testing and it looks good.

Thanks.

sdale511 avatar Feb 07 '16 18:02 sdale511

cool .. I will test it a bit more and then possibly merge with the master. Thanks for the feedback ..

debasishg avatar Feb 07 '16 19:02 debasishg

This should fix it and shouldn't break anyone's code, it's working for us

#171

Uxio0 avatar Jul 20 '16 12:07 Uxio0