Class Expirable<V>


  • public final class Expirable<V>
    extends java.lang.Object
    A value with an expiration timestamp.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long expireTimeMS  
      private V value  
    • Constructor Summary

      Constructors 
      Constructor Description
      Expirable​(V value, long expireTimeMS)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      V get()
      Returns the value.
      long getExpireTimeMS()
      Returns the time, in milliseconds, when the value will expire.
      boolean hasExpired​(long currentTimeMS)
      Returns if the value has expired and is eligible for eviction.
      boolean isEternal()
      Returns if the value will never expire.
      void setExpireTimeMS​(long expireTimeMS)
      Specifies the time, in milliseconds, when the value will expire.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • value

        private final V value
      • expireTimeMS

        private volatile long expireTimeMS
    • Constructor Detail

      • Expirable

        public Expirable​(V value,
                         long expireTimeMS)
    • Method Detail

      • get

        public V get()
        Returns the value.
      • getExpireTimeMS

        public long getExpireTimeMS()
        Returns the time, in milliseconds, when the value will expire.
      • setExpireTimeMS

        public void setExpireTimeMS​(long expireTimeMS)
        Specifies the time, in milliseconds, when the value will expire.
      • hasExpired

        public boolean hasExpired​(long currentTimeMS)
        Returns if the value has expired and is eligible for eviction.
      • isEternal

        public boolean isEternal()
        Returns if the value will never expire.
      • toString

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