python操作redis--pipeline
如何使用pipeline:
from redis.client import Redis conn = Redis(host="0.0.0.0",port=6379,db=0,password="") with conn.pipeline() as p: for i in range(100): p.set(f'key_{i}',i) p.execute() print(conn.get("key_1"))
如何使用pipeline:
from redis.client import Redis conn = Redis(host="0.0.0.0",port=6379,db=0,password="") with conn.pipeline() as p: for i in range(100): p.set(f'key_{i}',i) p.execute() print(conn.get("key_1"))