diff options
author | Vitaly Takmazov | 2019-08-02 13:37:51 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-08-02 13:37:51 +0300 |
commit | c8eeadee42695ed67dac47dbb9d7a66a1c9a8c6d (patch) | |
tree | 96a7d3a195fa953ecbb4637a429cbb740ac578a3 /src/main/java/com/juick/service/UserService.java | |
parent | 201d5d69beb431724de05908e7dabecacd6e68d7 (diff) |
Caching configuration for users and discussions
Diffstat (limited to 'src/main/java/com/juick/service/UserService.java')
-rw-r--r-- | src/main/java/com/juick/service/UserService.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/com/juick/service/UserService.java b/src/main/java/com/juick/service/UserService.java index 0d4efcfc..63b75110 100644 --- a/src/main/java/com/juick/service/UserService.java +++ b/src/main/java/com/juick/service/UserService.java @@ -20,9 +20,10 @@ 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; @@ -40,10 +41,12 @@ public interface UserService { String getSignUpHashByTelegramID(Long telegramId, String username); + @CacheEvict(value = "users_by_name", allEntries = true) Optional<User> createUser(String username, String password); Optional<User> getUserByUID(int uid); + @Cacheable(value = "users_by_name") @Nonnull User getUserByName(String username); @Nonnull User getUserByEmail(String email); |