def push_tweets_to_cache(cls, tweet): queryset = Tweet.objects.filter( user=tweet.user).order_by('-created_at') key = USER_TWEET_PATTERN.format(user_id=tweet.user_id) RedisHelper.push_objects(key, tweet, queryset)
def push_newsfeed_to_cache(cls, newsfeed): queryset = NewsFeed.objects.filter( user_id=newsfeed.user_id).order_by('-created_at') key = USER_NEWSFEEDS_PATTERN.format(user_id=newsfeed.user_id) return RedisHelper.push_objects(key, newsfeed, queryset)