Question

Let say I have a community with 50 000 members. So there are one Redis set called community_###_members with 50 000 sha1 keys of users and for each user his own set user_###_communities exists with sha1 hash of community above

In some time I decide to delete community.. What is the best algorithm to kill all members?

Thanks.

Was it helpful?

Solution

assuming you really want to actually delete members of a community that does not exist, it's something like (python code example):

memebrs = redis.smembers('community_members')
pipe = redis.pipeline()
pipe.delete('community_memebrs')
for member in members:
   pipe.delete(member)
pipe.execute()

if the community is very large you might want to do that N memebrs at a time, so the server will not stall until you finish all.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top