Class Expiration

    • Method Detail

      • onDate

        public static Expiration onDate​(Date expirationTime)
        Creates an expiration at specific date/time.
        Parameters:
        expirationTime - date/time after which an item must be discarded from the cache.
        Returns:
        a new Expiration object representing the given Date.
      • byDeltaMillis

        public static Expiration byDeltaMillis​(int milliDelay)
        Creates an Expiration for some number of milliseconds into the future.
        Parameters:
        milliDelay - amount of time, in milliseconds, after which an item must be discarded from the cache.
        Returns:
        a new Expiration representing the requested time.
      • byDeltaSeconds

        public static Expiration byDeltaSeconds​(int secondsDelay)
        Creates an Expiration for some number of seconds in the future.
        Parameters:
        secondsDelay - number of seconds after which an item must be discarded.
        Returns:
        a new Expiration for the requested time.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getMillisecondsValue

        public long getMillisecondsValue()
        Fetches the expiration date, in milliseconds-since-epoch.
        Returns:
        timestamp of expiration, even if constructed via a delta rather than fixed date.
      • getSecondsValue

        public int getSecondsValue()
        Fetches the expiration date, in seconds-since-epoch.
        Returns:
        timestamp of expiration, even if constructed via a delta rather than fixed date.