From 4f1b9963598fcd9d24a05c21560934b78709f031 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 9 Aug 2019 11:47:11 +0300 Subject: Revert "Evict caches on user changes, fix tests" This reverts commit 17578516fe0978602ddfac56055cfb1d1b2e0121. --- src/main/java/com/juick/service/CrosspostService.java | 4 ---- src/main/java/com/juick/service/EmailService.java | 3 --- src/main/java/com/juick/service/PrivacyQueriesService.java | 3 --- src/main/java/com/juick/service/SubscriptionService.java | 2 -- src/test/java/com/juick/server/tests/ServerTests.java | 4 +--- 5 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/main/java/com/juick/service/CrosspostService.java b/src/main/java/com/juick/service/CrosspostService.java index a8e66a68..28b9e8ab 100644 --- a/src/main/java/com/juick/service/CrosspostService.java +++ b/src/main/java/com/juick/service/CrosspostService.java @@ -20,7 +20,6 @@ package com.juick.service; import com.juick.ExternalToken; import com.juick.model.ApplicationStatus; import org.apache.commons.lang3.tuple.Pair; -import org.springframework.cache.annotation.CacheEvict; import javax.annotation.Nonnull; import java.util.Optional; @@ -73,18 +72,15 @@ public interface CrosspostService { String getTelegramNameByHash(String hash); - @CacheEvict(value = "users_by_name", allEntries = true) boolean setFacebookUser(String hash, int uid); String getVKNameByHash(String hash); boolean setVKUser(String hash, int uid); - @CacheEvict(value = "users_by_name", allEntries = true) boolean setTelegramUser(String hash, int uid); String getJIDByHash(String hash); - @CacheEvict(value = "users_by_name", allEntries = true) boolean setJIDUser(String hash, int uid); } diff --git a/src/main/java/com/juick/service/EmailService.java b/src/main/java/com/juick/service/EmailService.java index 26f26d59..0708cd96 100644 --- a/src/main/java/com/juick/service/EmailService.java +++ b/src/main/java/com/juick/service/EmailService.java @@ -17,15 +17,12 @@ package com.juick.service; -import org.springframework.cache.annotation.CacheEvict; - import java.util.List; /** * Created by vitalyster on 09.12.2016. */ public interface EmailService { - @CacheEvict(value = "users_by_name", allEntries = true) boolean verifyAddressByCode(Integer userId, String code); boolean addVerificationCode(Integer userId, String account, String code); boolean addEmail(Integer userId, String email); diff --git a/src/main/java/com/juick/service/PrivacyQueriesService.java b/src/main/java/com/juick/service/PrivacyQueriesService.java index b208c446..17dd6a9b 100644 --- a/src/main/java/com/juick/service/PrivacyQueriesService.java +++ b/src/main/java/com/juick/service/PrivacyQueriesService.java @@ -19,7 +19,6 @@ package com.juick.service; import com.juick.Tag; import com.juick.User; -import org.springframework.cache.annotation.CacheEvict; /** * Created by aalexeev on 11/13/16. @@ -29,9 +28,7 @@ public interface PrivacyQueriesService { Removed, Added } - @CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true) PrivacyResult blacklistUser(User user, User target); - @CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true) PrivacyResult blacklistTag(User user, Tag tag); } diff --git a/src/main/java/com/juick/service/SubscriptionService.java b/src/main/java/com/juick/service/SubscriptionService.java index b9bfcabd..8bc8d071 100644 --- a/src/main/java/com/juick/service/SubscriptionService.java +++ b/src/main/java/com/juick/service/SubscriptionService.java @@ -21,7 +21,6 @@ import com.juick.Message; import com.juick.Tag; import com.juick.User; import com.juick.model.NotifyOpts; -import org.springframework.cache.annotation.CacheEvict; import java.util.List; @@ -38,7 +37,6 @@ public interface SubscriptionService { List getUsersSubscribedToUserRecommendations(int uid, Message msg); - @CacheEvict(value = { "discussions" }, allEntries = true) boolean subscribeMessage(Message message, User user); boolean unSubscribeMessage(int mid, int vuid); diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 0064a589..de742447 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -1909,9 +1909,7 @@ public class ServerTests { @Test public void verifiedUsersTest(){ assertThat(userService.getUserByName("ugnich").isVerified(), is(false)); - crosspostService.addFacebookState("12345", "http://localhost"); - crosspostService.createFacebookUser(12345, "12345", "5678", "ugnich"); - crosspostService.setFacebookUser("12345", ugnich.getUid()); + jdbcTemplate.update("INSERT INTO facebook(user_id, fb_id) VALUES(?, ?)", ugnich.getUid(), "100001866137681"); assertThat(userService.getUserByName("ugnich").isVerified(), is(true)); } @Test -- cgit v1.2.3