♻️ Refactoring code. 缓存

This commit is contained in:
aeizzz 2022-12-23 14:52:24 +08:00
parent 0c6a93b0d2
commit 9f8be2bd6f
2 changed files with 8 additions and 8 deletions

View File

@ -84,7 +84,7 @@ public class PigRemoteRegisteredClientRepository implements RegisteredClientRepo
*/ */
@Override @Override
@SneakyThrows @SneakyThrows
// @Cacheable(value = CacheConstants.CLIENT_DETAILS_KEY, key = "#clientId", unless = "#result == null") @Cacheable(value = CacheConstants.CLIENT_DETAILS_KEY, key = "#clientId", unless = "#result == null")
public RegisteredClient findByClientId(String clientId) { public RegisteredClient findByClientId(String clientId) {
SysOauthClientDetails clientDetails = RetOps.of(clientDetailsService.getClientDetailsById(clientId)).getData() SysOauthClientDetails clientDetails = RetOps.of(clientDetailsService.getClientDetailsById(clientId)).getData()

View File

@ -50,16 +50,16 @@ public class PigUserDetailsServiceImpl implements PigUserDetailsService {
@Override @Override
@SneakyThrows @SneakyThrows
public UserDetails loadUserByUsername(String username) { public UserDetails loadUserByUsername(String username) {
// Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS); Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS);
// if (cache != null && cache.get(username) != null) { if (cache != null && cache.get(username) != null) {
// return (PigUser) cache.get(username).get(); return (PigUser) cache.get(username).get();
// } }
R<UserInfo> result = remoteUserService.info(username); R<UserInfo> result = remoteUserService.info(username);
UserDetails userDetails = getUserDetails(result); UserDetails userDetails = getUserDetails(result);
// if (cache != null) { if (cache != null) {
// cache.put(username, userDetails); cache.put(username, userDetails);
// } }
return userDetails; return userDetails;
} }