Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Adding IDs to a Redis HLL key using pipelining
def __add_to_hll(self):
self.redis_client.delete(self.hll_key_name)
pipeline = self.redis_client.pipeline()
batch_size = REDIS_PIPELINE_BATCH_SIZE
for hll_id in self.ids:
pipeline.pfadd(self.hll_key_name, hll_id)
batch_size -= 1
if batch_size == 0:
pipeline.execute()
batch_size = REDIS_PIPELINE_BATCH_SIZE
pipeline.execute()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment