Skip to content

Commit

Permalink
redis python pipline
Browse files Browse the repository at this point in the history
  • Loading branch information
gqdw committed Mar 25, 2016
1 parent 8d34ca3 commit f3303e0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions redis1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# coding: utf-8
import redis


# redis 的pipeline效率还是超高的,比普通的12s左右。pipeline的只要2.5s左右。10w的set对比。
r = redis.Redis(
host='127.0.0.1',
port=6379,
db=0)
for i in range(100000):
r.set(i,i)

pipe = r.pipeline(transaction=False)
for i in range(100000):
pipe.set(i,i)

pipe.execute()

0 comments on commit f3303e0

Please sign in to comment.