Class CacheRecord<V>

  • Type Parameters:
    V - The type of value.

    public class CacheRecord<V>
    extends java.lang.Object
    Implements a generic cache record.
    • Constructor Summary

      Constructors 
      Constructor Description
      CacheRecord​(V value, java.time.Instant lastAccess)
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      V getValue()
      Gets the cached value.
      boolean isExpired​(java.lang.Long timeToLiveMs)
      Tells if the cache has expired.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CacheRecord

        public CacheRecord​(V value,
                           java.time.Instant lastAccess)
        Constructs a new instance.
        Parameters:
        value - the value to cache
        lastAccess - the access time stamp
    • Method Detail

      • isExpired

        public boolean isExpired​(java.lang.Long timeToLiveMs)
        Tells if the cache has expired.
        Parameters:
        timeToLiveMs - milliseconds after last access
        Returns:
        a boolean
      • getValue

        public V getValue()
        Gets the cached value.
        Returns:
        a value
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object