Interface ExpirationPolicy

  • All Superinterfaces:
    java.io.Serializable

    public interface ExpirationPolicy
    extends java.io.Serializable
    Strategy that determines if the ticket is expired. Implementations of the Expiration Policy define their own rules on what they consider an expired Ticket to be.
    Since:
    3.0.0
    See Also:
    Ticket
    • Method Detail

      • isExpired

        boolean isExpired​(TicketState ticketState)
        Method to determine if a Ticket has expired or not, based on the policy.
        Parameters:
        ticketState - The snapshot of the current ticket state
        Returns:
        true if the ticket is expired, false otherwise.
      • getTimeToLive

        default java.lang.Long getTimeToLive​(TicketState ticketState)
        Method to determine the actual TTL of a Ticket, based on the policy.
        Parameters:
        ticketState - The snapshot of the current ticket state
        Returns:
        The time to live in seconds. A zero value indicates the time duration is not supported or is inactive.
      • getTimeToLive

        java.lang.Long getTimeToLive()
        Describes the time duration where this policy should consider the item alive. Once this time passes, the item is considered expired and dead.
        Returns:
        time to live in seconds. A zero value indicates the time duration is not supported or is inactive.
      • getTimeToIdle

        java.lang.Long getTimeToIdle()
        Describes the idle time duration for the item.
        Returns:
        idle time in seconds. A zero value indicates the time duration is not supported or is inactive. Unit of measure is defined by the implementation.
      • getName

        java.lang.String getName()
        Gets name of this expiration policy.
        Returns:
        the name
      • getClock

        java.time.Clock getClock()
        Gets clock of this expiration policy.
        Returns:
        the clock