Guest User

Untitled

a guest
Sep 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # ---------------------------------------------------------
  3.  
  4. import redis
  5.  
  6. POOL = redis.ConnectionPool(host='localhost',port=6379,db=0)
  7.  
  8. # ---------------------------------------------------------
  9.  
  10. def main():
  11.  
  12. red = redis.Redis(connection_pool=POOL)
  13. print red.info()['redis_version']
  14.  
  15. p = red.pipeline(transaction=False)
  16. for x in range(0,10000):
  17. red.hmset( "data", {x:x} )
  18. p.execute()
  19.  
  20. print red.info()['used_memory']
  21. for x in range(0,100):
  22. red.hmget( "data", range(0,10000) )
  23. print red.info()['used_memory']
  24.  
  25.  
  26. # ---------------------------------------------------------
  27.  
  28. main()
Add Comment
Please, Sign In to add comment