In [1]:from django_redis import get_redis_connection # 导入
get_redis_connection模块
In [2]: redis_client = get_redis_connection('default')# 连接redis 0号库'''方法1:使用普通方法执行'''
In [3]:for i inrange(99999):...: redis_client.set(i,i)'''方法2:使用pipeline执行'''
In [4]: p1 = redis_client.pipeline()# 实例化一个pipeline对象
In [5]:for i inrange(99999):...: p1.set(i,i)# 把要执行的命令打包到pipeline
In [6]: p1.execute()