Record Class SessionCache

java.lang.Object
java.lang.Record
io.github.mahmoudimus.quic.connection.SessionCache
Record Components:
tickets - the session tickets
tokens - the address validation tokens

public record SessionCache(ClientSessionStore tickets, TokenStore tokens) extends Record
What a client remembers about servers between connections: TLS session tickets, for resumption and 0-RTT (each ticket also carries the server's transport parameters, which 0-RTT data must keep within), and NEW_TOKEN tokens, which let a server skip its Retry round trip. Both are kept by server name (or by address when there is none) and handed out once.

Share one cache among the connections to the same servers; it is thread-safe.

  • Constructor Details

    • SessionCache

      public SessionCache(ClientSessionStore tickets, TokenStore tokens)
      A cache.
      Parameters:
      tickets - the session tickets
      tokens - the address validation tokens
  • Method Details

    • memory

      public static SessionCache memory()
      A bounded in-memory cache for 256 servers: up to 8 tickets and 2 tokens each.
      Returns:
      a new cache
    • none

      public static SessionCache none()
      A cache that remembers nothing: every connection makes a full handshake.
      Returns:
      the cache
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • tickets

      public ClientSessionStore tickets()
      Returns the value of the tickets record component.
      Returns:
      the value of the tickets record component
    • tokens

      public TokenStore tokens()
      Returns the value of the tokens record component.
      Returns:
      the value of the tokens record component