优化缓存

This commit is contained in:
zhou-hao
2017-12-01 03:25:27 +08:00
parent c899a0952b
commit 996b600a0e
2 changed files with 4 additions and 4 deletions

View File

@@ -101,9 +101,9 @@ public class SimpleAccessTokenService implements AccessTokenService {
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
@Caching(put = {
@CachePut(cacheNames = "oauth2-access-token", key = "'refresh:'+#token.refreshToken"),
@CachePut(cacheNames = "oauth2-access-token", key = "'token:'+#token.accessToken"),
@CachePut(cacheNames = "oauth2-access-token", key = "'cgo'+#token.clientId+#token.grantType+#token.ownerId")
@CachePut(cacheNames = "oauth2-access-token", key = "'refresh:'+#result.refreshToken"),
@CachePut(cacheNames = "oauth2-access-token", key = "'token:'+#result.accessToken"),
@CachePut(cacheNames = "oauth2-access-token", key = "'cgo'+#result.clientId+#result.grantType+#result.ownerId")
})
public OAuth2AccessToken saveOrUpdateToken(OAuth2AccessToken token) {
Assert.notNull(token, "token can not be null!");

View File

@@ -50,7 +50,7 @@ public class SimpleClientConfigRepository implements OAuth2ClientConfigRepositor
}
@Override
@Cacheable(key = "'ownerId:'+#id")
@Cacheable(key = "'ownerId:'+#ownerId")
public OAuth2Client getClientByOwnerId(String ownerId) {
return DefaultDSLQueryService.createQuery(oAuth2ClientDao).where("ownerId", ownerId).single();
}