Skip to content

Instantly share code, notes, and snippets.

@dspezia
Created April 1, 2012 17:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dspezia/2277130 to your computer and use it in GitHub Desktop.
Save dspezia/2277130 to your computer and use it in GitHub Desktop.
hmget memory issue
#!/usr/bin/env python
# ---------------------------------------------------------
import redis
POOL = redis.ConnectionPool(host='localhost',port=6379,db=0)
# ---------------------------------------------------------
def main():
red = redis.Redis(connection_pool=POOL)
print red.info()['redis_version']
p = red.pipeline(transaction=False)
for x in range(0,10000):
red.hmset( "data", {x:x} )
p.execute()
print red.info()['used_memory']
for x in range(0,100):
red.hmget( "data", range(0,10000) )
print red.info()['used_memory']
# ---------------------------------------------------------
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment