private async Task <bool> ProcessCreateTweetEvent(TweetEvent tweetEvent) { var tweet = await _tweetRepository.Get(tweetEvent.TweetId); if (tweet == null) { Console.WriteLine("No tweet found"); return(true); } var homeTimeLineEntry = new HomeTimeLineEntry { TweetId = tweetEvent.TweetId }; await _timeLineRepository.AddToHomeTimeLine(tweet.AuthorId, homeTimeLineEntry); return(true); }
// TODO: need to test this. public async Task <long> DeleteTweetFromHomeTimeLine(long userId, HomeTimeLineEntry homeTimeLineEntry) { var cacheKey = _timeLineServiceUtils.GetHomeTimeLineCacheKey(userId); return(await _redisCacheManger.SortedSetRemoveRangeByScore(cacheKey, homeTimeLineEntry.TweetId, homeTimeLineEntry.TweetId)); }
public async Task AddToHomeTimeLine(long userId, HomeTimeLineEntry homeTimeLineEntry) { var cacheKey = _timeLineServiceUtils.GetHomeTimeLineCacheKey(userId); await _redisCacheManger.SortedSetAdd <HomeTimeLineEntry>(cacheKey, homeTimeLineEntry, homeTimeLineEntry.TweetId); }