refresh
V2EX  ›  Redis

如何清除某个 hash 下的所有 key,或者删除某个以 xxx 开头的 key?

  •  
  •   refresh · Jun 16, 2014 · 9965 views
    This topic created in 4543 days ago, the information mentioned may be changed or developed.
    4 replies  •  2014-06-16 20:23:44 +08:00
    czheo
    czheo
    Jun 16, 2014 via iPhone
    1
    1 删hash
    2 用keys xx*搞出所有的key,然后一个一个del
    refresh
    refresh
    OP
    Jun 16, 2014
    2
    @czheo 如何删除hash?我没有找到相关的api
    keys xx*再del的效率太低

    其实我能删除hash就可以了,按key删除是没办法的事
    czheo
    czheo
    Jun 16, 2014 via iPhone
    3
    del不行么?
    dingyaguang117
    dingyaguang117
    Jun 16, 2014❤️1
    4
    redis-cli keys xx* |xargs redis-cli del
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4559 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 03:43 · PVG 11:43 · LAX 19:43 · JFK 22:43
    ♥ Do have faith in what you're doing.