aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service/UserService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/service/UserService.java')
-rw-r--r--src/main/java/com/juick/service/UserService.java9
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);