Empty/delete a set in Redis?

后端 未结 1 1942
误落风尘
误落风尘 2020-12-24 00:17

Maybe I\'m just blind, but I don\'t see an explicit set command in Redis for emptying an existing set (without emptying the entire database). For the time being, I\'m doing

相关标签:
1条回答
  • 2020-12-24 00:52

    You could delete the set altogether with DEL.

    DEL metasyn
    

    From redis console,

    redis> SMEMBERS metasyn
    1) "foo"
    2) "bar"
    redis> DEL metasyn
    (integer) 1
    redis> SMEMBERS metasyn
    (empty list or set)
    
    0 讨论(0)
提交回复
热议问题