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

API for removing members from set: SREM in scala code doesn't work

Open duneTwo opened this issue 8 years ago • 1 comments

I tried to use srem api to remove several members from a set. It doesn't work. It only works with one value. But it works when I use lower api: sene("SREM"), List(values)). scala> val y = new RedisClient("devhost",6379)

//This one doesn't delete at all scala> y.srem("mykey", List("1877522398","1877522399","1877522390")) res1: Option[Long] = Some(0)

//This one only delete 1877522398 scala> y.srem("mykey", "1877522398",List("1877522399","1877522390")) res2: Option[Long] = Some(1)

//This one doesn't delete anything scala> y.send("SREM",List("mykey",1877522398,1877522399,1877522390))_ res7: (=> Nothing) => Nothing =

//This one delete all three entries y.send("SREM",List("mykey"):::List("1877522398","1877522399","1877522390")){result: Any => } res12: Any => Unit =

How ever, by using the send API directly, I can't reuse the same redisClient instance for next read option. For each key I have, my code use smembers to get the values then use send("SREM") to remove certain values. I have to maintain two redisClient instances, one for read one for remove. If I use smembers and srem api to remove only one member each time, One redisClient instance works well.

duneTwo avatar Mar 10 '17 07:03 duneTwo

Thanks for reporting .. will try to fix soon.

debasishg avatar Mar 10 '17 09:03 debasishg