python redis scan keys 遍历

创建日期: 2024-05-29 17:05 | 作者: 风波 | 浏览次数: 10 | 分类: Redis

来源:https://stackoverflow.com/questions/22255589/get-all-keys-in-redis-database-with-python

import redis
r = redis.StrictRedis(host='localhost', port=6379, db=0)
for key in r.scan_iter("user:*"):
    # delete the key
    r.delete(key)
10 浏览
0 评论