Class SimpleExpiringValue<V>

  • Direct Known Subclasses:
    InactiveExpiringValue

    public class SimpleExpiringValue<V>
    extends ExpiringValue<V>
    ExpiringValue implementation which will expire the current value after a fixed amount of time.
    • Constructor Detail

      • SimpleExpiringValue

        public SimpleExpiringValue​(long valueTimeout)
      • SimpleExpiringValue

        public SimpleExpiringValue​(V value,
                                   long valueTimeout)
    • Method Detail

      • getTimeout

        protected long getTimeout()
        Gets the configured relative expire timeout for values cached by this instance.
      • getExpireTime

        protected long getExpireTime()
        Gets the absolute time at which the current value is no longer valid.
      • updateExpireTime

        protected void updateExpireTime()
        Updates the expire time to the current time plus the configured timeout
      • set

        public void set​(V value)
        Sets the current value

        Updates the expiration time via updateExpireTime() if the new value is non-null.

        Overrides:
        set in class ExpiringValue<V>
      • isValid

        public boolean isValid​(V curValue)
        Returns true if the expire time is greater than the current time, false otherwise.
        Specified by:
        isValid in class ExpiringValue<V>