Record Class RateLimiter.ClientStats

java.lang.Object
java.lang.Record
com.loomcache.server.network.RateLimiter.ClientStats
Enclosing class:
RateLimiter

public static record RateLimiter.ClientStats(String clientId, long requestsAllowed, long requestsDenied, double currentTokens, Instant lastAccessTime) extends Record
Per-client metrics snapshot.
Since:
1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    ClientStats(String clientId, long requestsAllowed, long requestsDenied, double currentTokens, Instant lastAccessTime)
    Creates an instance of a ClientStats record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the clientId record component.
    double
    Returns the value of the currentTokens record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the lastAccessTime record component.
    long
    Returns the value of the requestsAllowed record component.
    long
    Returns the value of the requestsDenied record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ClientStats

      public ClientStats(String clientId, long requestsAllowed, long requestsDenied, double currentTokens, Instant lastAccessTime)
      Creates an instance of a ClientStats record class.
      Parameters:
      clientId - the value for the clientId record component
      requestsAllowed - the value for the requestsAllowed record component
      requestsDenied - the value for the requestsDenied record component
      currentTokens - the value for the currentTokens record component
      lastAccessTime - the value for the lastAccessTime record component
  • Method Details

    • 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.
    • clientId

      public String clientId()
      Returns the value of the clientId record component.
      Returns:
      the value of the clientId record component
    • requestsAllowed

      public long requestsAllowed()
      Returns the value of the requestsAllowed record component.
      Returns:
      the value of the requestsAllowed record component
    • requestsDenied

      public long requestsDenied()
      Returns the value of the requestsDenied record component.
      Returns:
      the value of the requestsDenied record component
    • currentTokens

      public double currentTokens()
      Returns the value of the currentTokens record component.
      Returns:
      the value of the currentTokens record component
    • lastAccessTime

      public Instant lastAccessTime()
      Returns the value of the lastAccessTime record component.
      Returns:
      the value of the lastAccessTime record component