新增手动刷新token方法 #12

This commit is contained in:
jinyu
2015-09-27 21:36:05 +08:00
parent 8f0ddd421c
commit 12fdf6065b
7 changed files with 27 additions and 8 deletions
@@ -61,4 +61,17 @@ public final class TokenHolder {
public String getAccessToken() throws WeixinException {
return getToken().getAccessToken();
}
/**
* 手动刷新token
*
* @return 刷新后的token
* @throws WeixinException
*/
public Token refreshToken() throws WeixinException {
String cacheKey = tokenCreator.getCacheKey();
Token token = tokenCreator.createToken();
tokenStorager.caching(cacheKey, token);
return token;
}
}