智眸token缓存优化
This commit is contained in:
parent
1591170585
commit
f2e69091f0
|
|
@ -118,7 +118,7 @@ public class ZhiMouServiceImpl implements ZhiMouService {
|
|||
|
||||
@Override
|
||||
public ZhiMouInfo getToken() {
|
||||
Object tokenObj = CacheUtils.get(BusinessConstant.ZHIMOU_TOKEN);
|
||||
Object tokenObj = CacheUtils.getWithoutReset(BusinessConstant.ZHIMOU_TOKEN);
|
||||
if (tokenObj instanceof ZhiMouInfo) {
|
||||
return (ZhiMouInfo) tokenObj;
|
||||
}
|
||||
|
|
@ -155,8 +155,8 @@ public class ZhiMouServiceImpl implements ZhiMouService {
|
|||
info.setUrl(url);
|
||||
info.setToken(result.getJSONObject("data").getString("token"));
|
||||
info.setExpire(result.getJSONObject("data").getLong("expires_at"));
|
||||
//官方说过期2小时,这里设置1小时缓存
|
||||
CacheUtils.set(BusinessConstant.ZHIMOU_TOKEN, info);
|
||||
//官方说过期2小时,这里设置半小时缓存
|
||||
CacheUtils.set(BusinessConstant.ZHIMOU_TOKEN, info, 30 * 60 * 1000);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue