From 4d67541a40fffd9ec93e314d05ad4d53734473dd Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 9 Aug 2019 11:47:22 +0300 Subject: Revert "Caching configuration for users and discussions" This reverts commit c8eeadee42695ed67dac47dbb9d7a66a1c9a8c6d. --- .../java/com/juick/server/configuration/WwwAppConfiguration.java | 5 ++--- src/main/java/com/juick/service/MessagesService.java | 5 ----- src/main/java/com/juick/service/UserService.java | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/main/java/com/juick/server/configuration/WwwAppConfiguration.java b/src/main/java/com/juick/server/configuration/WwwAppConfiguration.java index 0c5c8dbf..635302c7 100644 --- a/src/main/java/com/juick/server/configuration/WwwAppConfiguration.java +++ b/src/main/java/com/juick/server/configuration/WwwAppConfiguration.java @@ -32,7 +32,6 @@ import org.commonmark.node.Link; import org.commonmark.parser.Parser; import org.commonmark.renderer.html.HtmlRenderer; import org.springframework.beans.factory.annotation.Value; -import org.springframework.cache.CacheManager; import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.caffeine.CaffeineCacheManager; import org.springframework.context.annotation.Bean; @@ -62,8 +61,8 @@ public class WwwAppConfiguration implements WebMvcConfigurer { @Value("${img_path:#{systemEnvironment['TEMP'] ?: '/tmp'}}") private String imgDir; @Bean - public CacheManager cacheManager() { - return new CaffeineCacheManager("help", "users_by_name", "discussions"); + public CaffeineCacheManager cacheManager() { + return new CaffeineCacheManager("help"); } @Bean diff --git a/src/main/java/com/juick/service/MessagesService.java b/src/main/java/com/juick/service/MessagesService.java index 490e0cfc..e98b2b1d 100644 --- a/src/main/java/com/juick/service/MessagesService.java +++ b/src/main/java/com/juick/service/MessagesService.java @@ -22,8 +22,6 @@ import com.juick.Reaction; import com.juick.User; import com.juick.model.ResponseReply; import org.apache.commons.lang3.tuple.Pair; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import java.net.URI; import java.util.*; @@ -32,10 +30,8 @@ import java.util.*; * Created by aalexeev on 11/13/16. */ public interface MessagesService { - @CacheEvict(value = "discussions", allEntries = true) int createMessage(int uid, String txt, String attachment, List tags); - @CacheEvict(value = "discussions", allEntries = true) int createReply(int mid, int rid, User user, String txt, String attachment); int getReplyIDIncrement(int mid); @@ -87,7 +83,6 @@ public interface MessagesService { List getPrivate(int uid, int before); - @Cacheable(value = "discussions", key="#uid") List getDiscussions(int uid, Long to); List getRecommended(int uid, int before); diff --git a/src/main/java/com/juick/service/UserService.java b/src/main/java/com/juick/service/UserService.java index 63b75110..0d4efcfc 100644 --- a/src/main/java/com/juick/service/UserService.java +++ b/src/main/java/com/juick/service/UserService.java @@ -20,10 +20,9 @@ package com.juick.service; import com.juick.Message; import com.juick.User; import com.juick.model.Auth; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import javax.annotation.Nonnull; +import java.time.Instant; import java.util.Collection; import java.util.List; import java.util.Optional; @@ -41,12 +40,10 @@ public interface UserService { String getSignUpHashByTelegramID(Long telegramId, String username); - @CacheEvict(value = "users_by_name", allEntries = true) Optional createUser(String username, String password); Optional getUserByUID(int uid); - @Cacheable(value = "users_by_name") @Nonnull User getUserByName(String username); @Nonnull User getUserByEmail(String email); -- cgit v1.2.3