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
键 -
obj
值对象 -
ttl
protected final long ttl对象存活时长,0表示永久存活 -
lastAccess
protected volatile long lastAccess上次访问时间 -
accessCount
访问次数
-
-
Constructor Details
-
CacheObject
构造- Parameters:
key- 键obj- 值ttl- 超时时长
-
-
Method Details
-
getKey
获取键- Returns:
- 键
-
getValue
获取值- Returns:
- 值
-
getTtl
public long getTtl()获取对象存活时长,即超时总时长,0表示无限- Returns:
- 对象存活时长
-
getExpiredTime
获取过期时间,返回null表示永不过期- Returns:
- 此对象的过期时间,返回
null表示永不过期
-
getLastAccess
public long getLastAccess()获取上次访问时间- Returns:
- 上次访问时间
-
toString
-
isExpired
protected boolean isExpired()判断是否过期- Returns:
- 是否过期
-
get
获取值- Parameters:
isUpdateLastAccess- 是否更新最后访问时间- Returns:
- 获得对象
-