search

Home  >  Q&A  >  body text

linux - How to batch delete keys of a specific pattern under Redis

redis can find the keys of the specified pattern:

redis-cli -h [host] -p [port] -n [db] KEYS "pattern"

But how to delete the keys of a specific pattern during the delete operation?

过去多啦不再A梦过去多啦不再A梦2753 days ago1395

reply all(2)I'll reply

  • 欧阳克

    欧阳克2017-06-29 10:11:05

    Delete keys of a specific pattern in batches under Redis

    redis-cli -h [host] -p [port] -n [db] KEYS "pattern" | xargs redis-cli -h [host] -p [port] -n [db] DEL

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-06-29 10:11:05

    How to atomically delete keys matching a pattern using Redis

    reply
    0
  • Cancelreply