diff options
author | Vitaly Takmazov | 2022-12-09 14:45:24 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-12-09 14:45:52 +0300 |
commit | a5ccfcd3f3e8d96250c92638cf2f66736827ffbc (patch) | |
tree | ddab5a2464976533d27ae9eb92dfcb5b71c9b06b /src/main/java/com/juick/service/UserService.java | |
parent | 13b81d40fde2939500924403dd767bdc9887ff14 (diff) |
Better caching in AnythingFilter
Diffstat (limited to 'src/main/java/com/juick/service/UserService.java')
-rw-r--r-- | src/main/java/com/juick/service/UserService.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/com/juick/service/UserService.java b/src/main/java/com/juick/service/UserService.java index a3ab8315..db02c34e 100644 --- a/src/main/java/com/juick/service/UserService.java +++ b/src/main/java/com/juick/service/UserService.java @@ -46,12 +46,15 @@ public interface UserService { String getSignUpHashByTelegramID(Long telegramId, String username); - @CacheEvict(value = "users_by_name", allEntries = true) + @CacheEvict(value = { "usernames", "users_by_name" }, allEntries = true) Optional<User> createUser(String username, String password) throws UsernameTakenException; Optional<User> getUserByUID(int uid); - @Cacheable(value = "users_by_name") + @Cacheable(value = "usernames") + List<String> getUsernames(); + + @Cacheable(value = "users_by_name", key = "{ #username }") @Nonnull User getUserByName(String username); @Nonnull User getUserByEmail(String email); |