title: using pipeline for bulk processing in redis (python example)
body: <p>I'm trying to clear my concept of pipelining implemented in redis, using a python client. Take the following example:</p>
  
  <pre><code>my_server = redis.Redis(connection_pool=POOL)
  for obj_id in list_of_obj_ids:
      hash_name="n:"+str(obj_id)
      sorted_set = "s:"+str(obj_id)
      if my_server.exists(hash_name):
          my_server.hset(hash_name,'val',0)
      if my_server.zcard(sorted_set):
          my_server.zadd(sorted_set, hash_name, time.time())
  </code></pre>
  
  <p>I.e. I'm updating multiple hashes via iterating through a for loop. How can I accomplish this kind of bulk update via pipelining? From what I've read, the following is what comes to my mind:</p>
  
  <pre><code>my_server = redis.Redis(connection_pool=POOL)
  p = my_server.pipeline()
  for obj_id in list_of_obj_ids:
      hash_name="n:"+str(obj_id)
      sorted_set="s:"+str(obj_id)
      if p.exists(hash_name):
          p.hset(hash_name,'val',0)
      if p.zcard(sorted_set):
          p.zadd(sorted_set, hash_name, time.time())
  p.execute()
  </code></pre>
  
  <p>Is this correct?</p>