Class CacheObject<K,V>
java.lang.Object
org.miaixz.bus.core.cache.provider.CacheObject<K,V>
- Type Parameters:
K- Key类型V- Value类型
- All Implemented Interfaces:
Serializable
缓存对象
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AtomicLong访问次数protected final K键protected long上次访问时间protected final V值对象protected final long对象存活时长,0表示永久存活 -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
key
键 -
object
值对象 -
ttl
protected final long ttl对象存活时长,0表示永久存活 -
lastAccess
protected volatile long lastAccess上次访问时间 -
accessCount
访问次数
-
-
Constructor Details
-
CacheObject
-
-
Method Details
-
getKey
-
getValue
-
getTtl
public long getTtl()获取对象存活时长,即超时总时长,0表示无限- Returns:
- 对象存活时长
-
getExpiredTime
-
getLastAccess
public long getLastAccess()获取上次访问时间- Returns:
- 上次访问时间
-
toString
-
isExpired
protected boolean isExpired()判断是否过期- Returns:
- 是否过期
-
get
获取值- Parameters:
isUpdateLastAccess- 是否更新最后访问时间- Returns:
- 获得对象
-