Deleting data that is no longer needed is a common maintenance task you perform on a regular basis.
Use the ZREM
Redis ZSET
command to delete a member and score in a ZSET
like this :
127.0.0.1:6379> ZREM "id" "Mark"
(integer) 1
127.0.0.1:6379> ZREM "id" "Mark"
(integer) 0
In the example above, the ZREM
command removed the ZSET
item. You can tell because it looked for the member and score again and 0 was returned. This shows that you have successfully removed the item from the ZSET
. If you look for the item again, a 0 will display in the results.