java springboot调用第三方接口的token存储在哪里

java springboot调用第三方接口获取的token用于接下来的请求,
可以不存数据库吗

    public class TokenTest {

    private static String token = null;

    public String getToken() {
        if (token == null){
            token = getTokenFromThird();
        }
        return token;
    }

    private String getTokenFromThird(){
        return "从第三方得到的token";
    }
}

一般来说accessToken都是存在缓存中,过期时间一般也是低于accessToken的过期时间,例如Token过期时间为6小时,你在缓存中可以设置为提前1分钟过期之类的