Class ExpiringValue<V>

  • Direct Known Subclasses:
    SimpleExpiringValue

    public abstract class ExpiringValue<V>
    extends Object
    Base class for tracking a value which needs to expire after a certain amount of time or inactivity. When the current value is no longer valid, get() will return null.

    This class is not thread-safe. The expectation is that subtypes of this class will be used within a ConnectorCache instance which manages the thread-safety.

    • Constructor Detail

      • ExpiringValue

        public ExpiringValue()
      • ExpiringValue

        public ExpiringValue​(V value)
    • Method Detail

      • get

        public V get()
        Gets the current, valid value, null otherwise. If the current value is not valid, it will be cleared by this call before returning.
      • set

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

        public abstract boolean isValid​(V curValue)
        Returns true if the given value is still valid, false otherwise.