Class CacheObject<K,V>

java.lang.Object
com.xxl.tool.cache.model.CacheObject<K,V>
All Implemented Interfaces:
Serializable

public class CacheObject<K,V> extends Object implements Serializable
Cache Object
See Also:
  • Constructor Details

    • CacheObject

      public CacheObject(K key, V value, long ttl, boolean expireType)
      构造
      Parameters:
      key - 键
      value - 值
      ttl - 超时时长
      expireType - 过期策略,true 表示 expireAfterAccess,false 表示 expireAfterWrite
  • Method Details

    • getKey

      public K getKey()
    • getValue

      public V getValue()
    • getTtl

      public long getTtl()
    • getExpiredTime

      public Date getExpiredTime()
      获取过期时间,返回 null 表示永不过期
    • getLastAccess

      public long getLastAccess()
      获取上次访问时间
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isExpired

      public boolean isExpired()
      判断是否过期
    • get

      public V get(boolean isUpdateLastAccess)
      获取值
      Parameters:
      isUpdateLastAccess - 是否更新最后访问时间
      Returns:
      获得对象
    • getAccessCount

      public AtomicLong getAccessCount()
      获取访问次数