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) RedisHelper.push_object(key, newsfeed, queryset)
def push_tweet_to_cache(cls, tweet): queryset = Tweet.objects.filter( user_id=tweet.user_id).order_by('-created_at') key = USER_TWEETS_PATTERN.format(user_id=tweet.user_id) return RedisHelper.push_object(key, tweet, queryset)