摘要: 1 lpush(name, values) # resp:上面是左,下面是右 conn.lpush('girls', '刘亦菲') # 从左侧插入值 conn.lpush('girls', '迪丽热巴') # 从左侧插入值 2 rpush(name, values) 表示从右向左操作 conn.rp 阅读全文
posted @ 2024-01-28 21:17 wellplayed 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1 hset(name, key, value) 设置值 conn.hset('userinfo','name','xxx') conn.hset('userinfo','age',18) 2 hmset(name, mapping) 批量设置 conn.hmset('userinfo',{'nam 阅读全文
posted @ 2024-01-28 20:55 wellplayed 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 1 set(name, value, ex=None, px=None, nx=False, xx=False) 设置值 conn.set('hobby','篮球') # 带过期时间 conn.set('age','19',ex=3) # 秒 # conn.set('age','19',px=300 阅读全文
posted @ 2024-01-28 20:40 wellplayed 阅读(10) 评论(0) 推荐(0) 编辑
摘要: Python操作redis 1.普通链接 首先需要下载redis模块 pip install redis 使用方式(redis内需要插入name=xxx): from redis import Redis conn = Redis(host="localhost", port=6379, db=0, 阅读全文
posted @ 2024-01-28 16:01 wellplayed 阅读(4) 评论(0) 推荐(0) 编辑