Пример #1
0
 def push_newsfeed_to_cache(cls, newsfeed):
     # queryset lazy loading
     queryset = NewsFeed.objects.filter(user_id=newsfeed.user_id)
     name = USER_NEWSFEED_PATTERN.format(user_id=newsfeed.user_id)
     return RedisHelper.push_object_to_cache(name, queryset, newsfeed)
Пример #2
0
 def push_tweet_to_cache(cls, tweet):
     queryset = Tweet.objects.filter(
         user_id=tweet.user_id).order_by('-created_at')
     name = USER_TWEET_PATTERN.format(user_id=tweet.user_id)
     return RedisHelper.push_object_to_cache(name, queryset, tweet)