通配符查询删除redis

import redis

pool = redis.ConnectionPool(host='10.173.39.233', port=6379, db=0, password=密码)
r = redis.Redis(connection_pool=pool)

key_list = []
for key in r.scan_iter(match='name*', count=10000):
    key_list.append(key)

for key in key_list:
  r.delete(key)

你可能感兴趣的:(通配符查询删除redis)