diff options
author | Vitaly Takmazov | 2022-04-07 11:13:58 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-12-08 08:09:37 +0300 |
commit | 912171165155ff78ad111c9c4043844c34567a42 (patch) | |
tree | 876278eb4338d73d294ef55f10471d08f2b3e38b /src/main/java/com/juick/service/UserService.java | |
parent | a6dff3324a55540877deaed23083ea502706a5ae (diff) |
Configure caches
* caching is disabled because of OOMs in production
Diffstat (limited to 'src/main/java/com/juick/service/UserService.java')
-rw-r--r-- | src/main/java/com/juick/service/UserService.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/com/juick/service/UserService.java b/src/main/java/com/juick/service/UserService.java index 06637aee..a3ab8315 100644 --- a/src/main/java/com/juick/service/UserService.java +++ b/src/main/java/com/juick/service/UserService.java @@ -25,6 +25,8 @@ import com.juick.model.ExternalToken; import com.juick.util.UsernameTakenException; import org.apache.commons.lang3.tuple.Pair; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; import javax.annotation.Nonnull; import java.util.Collection; @@ -44,10 +46,12 @@ public interface UserService { String getSignUpHashByTelegramID(Long telegramId, String username); + @CacheEvict(value = "users_by_name", allEntries = true) Optional<User> createUser(String username, String password) throws UsernameTakenException; Optional<User> getUserByUID(int uid); + @Cacheable(value = "users_by_name") @Nonnull User getUserByName(String username); @Nonnull User getUserByEmail(String email); @@ -69,6 +73,7 @@ public interface UserService { Optional<User> checkPassword(String username, String password); + @CacheEvict(value = "users_by_name", allEntries = true) boolean updatePassword(User user, String newPassword); int getUserOptionInt(int uid, String option, int defaultValue); @@ -174,16 +179,20 @@ public interface UserService { String getTelegramNameByHash(String hash); + @CacheEvict(value = "users_by_name", allEntries = true) boolean setFacebookUser(String hash, int uid); String getVKNameByHash(String hash); + @CacheEvict(value = "users_by_name", allEntries = true) 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); boolean canDeleteTelegramUser(User user); |