private void GetUserLikes(string currUserId) { // Get from cache userReviewLikesIds = _userLikesCacheService.GetUserLikedReviewsIds(currUserId); userCommentLikesIds = _userLikesCacheService.GetUserLikedCommentsIds(currUserId); userReviewDislikesIds = _userLikesCacheService.GetUserDisikedReviewsIds(currUserId); userCommentDislikesIds = _userLikesCacheService.GetUserDisikedCommentsIds(currUserId); userPostLikesIds = _userLikesCacheService.GetUserLikedPostsIds(currUserId); // If not check the Database if (userReviewLikesIds == null || userReviewLikesIds.Count() == 0) { userReviewLikesIds = _userLikesDataService.GetUserLikedReviewsIds(currUserId); _userLikesCacheService.SetUserLikedReviewsIds(currUserId, userReviewLikesIds, 20); } if (userCommentLikesIds == null || userCommentLikesIds.Count() == 0) { userCommentLikesIds = _userLikesDataService.GetUserLikedCommentsIds(currUserId); _userLikesCacheService.SetUserLikedCommentsIds(currUserId, userCommentLikesIds, 20); } if (userReviewDislikesIds == null || userReviewDislikesIds.Count() == 0) { userReviewDislikesIds = _userLikesDataService.GetUserDisikedReviewsIds(currUserId); _userLikesCacheService.SetUserDisikedReviewsIds(currUserId, userReviewDislikesIds, 20); } if (userCommentDislikesIds == null || userCommentDislikesIds.Count() == 0) { userCommentDislikesIds = _userLikesDataService.GetUserDisikedCommentsIds(currUserId); _userLikesCacheService.SetUserDisikedCommentsIds(currUserId, userCommentDislikesIds, 20); } if (userPostLikesIds == null || userPostLikesIds.Count() == 0) { userPostLikesIds = _userLikesDataService.GetUserLikedPostsIds(currUserId); _userLikesCacheService.SetUserLikedPostsIds(currUserId, userPostLikesIds, 20); } }
private void GetUserLikes(string currUserId) { // Get from cache userReviewLikesIds = _userLikesCacheService.GetUserLikedReviewsIds(currUserId); userCommentLikesIds = _userLikesCacheService.GetUserLikedCommentsIds(currUserId); userReviewDislikesIds = _userLikesCacheService.GetUserDisikedReviewsIds(currUserId); userCommentDislikesIds = _userLikesCacheService.GetUserDisikedCommentsIds(currUserId); userPostLikesIds = _userLikesCacheService.GetUserLikedPostsIds(currUserId); userGroupFollowIds = _userLikesCacheService.GetUserFollowingGroupsIds(currUserId); currentUserFollowings = _userFollowCacheService.GetFollowingUserIds(currUserId); // If not check the Database if (userReviewLikesIds == null || userReviewLikesIds.Count() == 0) { userReviewLikesIds = _userLikesDataService.GetUserLikedReviewsIds(currUserId); _userLikesCacheService.SetUserLikedReviewsIds(currUserId, userReviewLikesIds, 20); } if (userCommentLikesIds == null || userCommentLikesIds.Count() == 0) { userCommentLikesIds = _userLikesDataService.GetUserLikedCommentsIds(currUserId); _userLikesCacheService.SetUserLikedCommentsIds(currUserId, userCommentLikesIds, 20); } if (userReviewDislikesIds == null || userReviewDislikesIds.Count() == 0) { userReviewDislikesIds = _userLikesDataService.GetUserDisikedReviewsIds(currUserId); _userLikesCacheService.SetUserDisikedReviewsIds(currUserId, userReviewDislikesIds, 20); } if (userCommentDislikesIds == null || userCommentDislikesIds.Count() == 0) { userCommentDislikesIds = _userLikesDataService.GetUserDisikedCommentsIds(currUserId); _userLikesCacheService.SetUserDisikedCommentsIds(currUserId, userCommentDislikesIds, 20); } if (userPostLikesIds == null || userPostLikesIds.Count() == 0) { userPostLikesIds = _userLikesDataService.GetUserLikedPostsIds(currUserId); _userLikesCacheService.SetUserLikedPostsIds(currUserId, userPostLikesIds, 20); } if (userGroupFollowIds == null || userGroupFollowIds.Count() == 0) { userGroupFollowIds = _userLikesDataService.GetUserFollowingGroups(currUserId, 30); _userLikesCacheService.SetUserFollowingGroupsIds(currUserId, userGroupFollowIds, 20); } if (currentUserFollowings == null || currentUserFollowings.Count == 0) { currentUserFollowings = _userLikesDataService.GetFollowingUserIds(currUserId); if (currentUserFollowings == null) { currentUserFollowings = new Dictionary <string, FollowState>(); } else { _userFollowCacheService.SetFollowingUserIds(currUserId, currentUserFollowings, 10); } } }
private void GetUserLikes(string currUserId) { prevLikedReviews = _userLikeCacheService.GetUserLikedReviewsIds(currUserId) ?? _userLikeDataService.GetUserLikedReviewsIds(currUserId); prevDislikedReviews = _userLikeCacheService.GetUserDisikedReviewsIds(currUserId) ?? _userLikeDataService.GetUserDisikedReviewsIds(currUserId); }