mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-22 20:54:25 +08:00
♻️ Refactoring code. 缓存
This commit is contained in:
parent
0c6a93b0d2
commit
9f8be2bd6f
@ -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()
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user