mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-22 12:48:58 +08:00
♻️ Refactoring code. 缓存
This commit is contained in:
parent
0c6a93b0d2
commit
9f8be2bd6f
@ -84,7 +84,7 @@ public class PigRemoteRegisteredClientRepository implements RegisteredClientRepo
|
||||
*/
|
||||
@Override
|
||||
@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) {
|
||||
|
||||
SysOauthClientDetails clientDetails = RetOps.of(clientDetailsService.getClientDetailsById(clientId)).getData()
|
||||
|
@ -50,16 +50,16 @@ public class PigUserDetailsServiceImpl implements PigUserDetailsService {
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public UserDetails loadUserByUsername(String username) {
|
||||
// Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS);
|
||||
// if (cache != null && cache.get(username) != null) {
|
||||
// return (PigUser) cache.get(username).get();
|
||||
// }
|
||||
Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS);
|
||||
if (cache != null && cache.get(username) != null) {
|
||||
return (PigUser) cache.get(username).get();
|
||||
}
|
||||
|
||||
R<UserInfo> result = remoteUserService.info(username);
|
||||
UserDetails userDetails = getUserDetails(result);
|
||||
// if (cache != null) {
|
||||
// cache.put(username, userDetails);
|
||||
// }
|
||||
if (cache != null) {
|
||||
cache.put(username, userDetails);
|
||||
}
|
||||
return userDetails;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user