redis 的其他常用操作

#-*- coding: utf8 -*-

import redis



pool = redis.ConnectionPool()

r = redis.Redis(connection_pool=pool)
 
# 删除操作
print(r.keys())  
r.delete(*["xxx"])         # 要加星号 *


# 查看所有 Redis的 name
#keys(pattern='*')
keys *   #  匹配所有的key
keys h?llo # 匹配hello , hallo ,hxllo 等
keys h*llo  # 匹配hllo 
keys h[ae]llo  # 匹配 hello 和hallo 但不匹配hillo

  

猜你喜欢

转载自www.cnblogs.com/eliwen/p/11997486.html