action_func.py 461 B

1234567891011121314
  1. # 批量模糊删除缓存
  2. from tools import redis_client, loggerKit
  3. def del_key_vague(device_id):
  4. # 批量模糊删除keys
  5. keys = redis_client.match_pattern_prefix(device_id)
  6. if len(keys) > 0:
  7. # 需要判断是否有匹配的值, 没有的话会报错
  8. for key in keys:
  9. redis_client.delete(key)
  10. loggerKit.info(f"clear {device_id} keys success...")
  11. else:
  12. loggerKit.info(f"{device_id} keys none ...")