change name

This commit is contained in:
Looly
2020-12-07 19:06:23 +08:00
parent 775afa68cc
commit ea070bf83e
7 changed files with 18 additions and 15 deletions

View File

@@ -44,9 +44,8 @@ public class CacheObj<K, V> implements Serializable{
*/
boolean isExpired() {
if(this.ttl > 0) {
final long expiredTime = this.lastAccess + this.ttl;
// expiredTime > 0 杜绝Long类型溢出变负数问题当当前时间超过过期时间表示过期
return expiredTime > 0 && expiredTime < System.currentTimeMillis();
// 此处不考虑时间回拨
return (System.currentTimeMillis() - this.lastAccess) > this.ttl;
}
return false;
}