Record Class IdempotencyManager.CachedResponse

java.lang.Object
java.lang.Record
com.loomcache.server.handler.IdempotencyManager.CachedResponse
Enclosing class:
IdempotencyManager

public static record IdempotencyManager.CachedResponse(IdempotencyManager.IdempotencyKey key, Message response, long completedAt, long expiresAt, boolean cpOperation) extends Record
Record representing a cached response with metadata.
  • Constructor Details

    • CachedResponse

      public CachedResponse(IdempotencyManager.IdempotencyKey key, Message response, long completedAt, long expiresAt, boolean cpOperation)
      Creates an instance of a CachedResponse record class.
      Parameters:
      key - the value for the key record component
      response - the value for the response record component
      completedAt - the value for the completedAt record component
      expiresAt - the value for the expiresAt record component
      cpOperation - the value for the cpOperation record component
  • Method Details

    • isExpired

      public boolean isExpired(long currentTimeMs)
      Checks if this cached response has expired.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • key

      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • response

      public Message response()
      Returns the value of the response record component.
      Returns:
      the value of the response record component
    • completedAt

      public long completedAt()
      Returns the value of the completedAt record component.
      Returns:
      the value of the completedAt record component
    • expiresAt

      public long expiresAt()
      Returns the value of the expiresAt record component.
      Returns:
      the value of the expiresAt record component
    • cpOperation

      public boolean cpOperation()
      Returns the value of the cpOperation record component.
      Returns:
      the value of the cpOperation record component