3

My Redis key has got special characters. I tried the following commands but no use.

redis-cli  keys *ueryLikesApp*
1) "\xac\xed\x00\x05t\x00\x1dqueryLikesApps04ea56ff2567012"
redis-cli --scan --pattern "*Likes*" 

No data found

redis-cli keys  "*Likes*"|xargs redis-cli  del

No data found

how to delete these redis key?

Shalem
  • 1,446
  • 2
  • 22
  • 47

1 Answers1

0

As in How to atomically delete keys matching a pattern using Redis, this will work, using Lua scripting:

redis-cli EVAL "return redis.call('del', unpack(redis.call('keys', ARGV[1])))" 0 "*Likes*"

And if you have thousands of keys

EVAL "local keys = redis.call('keys', ARGV[1]) \n for i=1,#keys,5000 do \n redis.call('del', unpack(keys, i, math.min(i+4999, #keys))) \n end \n return keys" 0 "*Likes*"
LeoMurillo
  • 6,048
  • 1
  • 19
  • 34