1

I am using Ruby 2.5.1 and trying to delete keys from redis using HDEL. But it doesn't work key with spaces. I can delete with the quotes from redis-cli but I need to write a code to delete keys with space.

Sample value

["play group_1", "{\"id\":\"1\",\"name\":\"Play Group\"}"]

Delete not working in redis-cli (If doesn't passing single quotes with in it),

127.0.0.1:6379> HDEL development_groups play group_1
(integer) 0

Delete works in redis-cli (If passing single quotes with in it),

127.0.0.1:6379> HDEL development_groups 'play group_1'
(integer) 1

Ruby code,

redis.hdel(index, key)

How to delete keys with space using HDEL?

SST
  • 2,054
  • 5
  • 35
  • 65

1 Answers1

0

Try with to_s option

i.e) key.to_s

Beu
  • 1,370
  • 10
  • 23