Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class TokenCache {
private String token;
private LocalDateTime expire;
private String getToken(){
if(token==null
|| LocalDateTime.now().compareTo(expire)>0){
refreshToken();
}
return token;
}
private void refreshToken(){
//获取token的代码
//更新expire,比官方的过期时间稍早一些
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.