def update_sticky_thread_cache(): threads = RedisList(STICKY_THREAD_CACHE_KEY) threads.delete() for x in [ util.dumps((x.comment.id, x.text)) for x in StickyThread.objects.all() ]: threads.rpush(x)
def update_scores(self): for algo in self.algorithms: ranking = algo.fun() temp_list = RedisList(gen_temp_key()) if ranking: for comment in ranking: temp_list.rpush(comment.id) # Atomically replace the frontpage with the new version. temp_list.rename(algo.frontpage.key) else: # If the ranking is empty, we just delete the frontpage key (the rename will fail) algo.frontpage.delete()
def update_sticky_thread_cache(): threads = RedisList(STICKY_THREAD_CACHE_KEY) threads.delete() for x in [util.dumps((x.comment.id, x.text)) for x in StickyThread.objects.all()]: threads.rpush(x)