Record Class LoomMap.LoomMapStats

java.lang.Object
java.lang.Record
com.loomcache.client.LoomMap.LoomMapStats
Record Components:
localCacheHits - number of operations satisfied without a remote round-trip
remoteFetches - number of operations that issued a remote request
totalOps - total number of operations performed
avgLatencyMs - average operation latency in milliseconds
Enclosing class:
LoomMap<K,V>

public static record LoomMap.LoomMapStats(long localCacheHits, long remoteFetches, long totalOps, double avgLatencyMs) extends Record
Statistics snapshot for a LoomMap operation.

localCacheHits reflects the fraction of operations whose result was served without hitting the wire — i.e. totalOps - remoteFetches. Every LoomMap call that reaches the client goes through the shared LoomClient, which handles its own near cache; LoomMap itself only measures the work it dispatches, so in the absence of richer bookkeeping every recorded operation is counted as a remote fetch and localCacheHits stays at zero.

Since:
1.0
  • Constructor Details

    • LoomMapStats

      public LoomMapStats(long localCacheHits, long remoteFetches, long totalOps, double avgLatencyMs)
      Creates an instance of a LoomMapStats record class.
      Parameters:
      localCacheHits - the value for the localCacheHits record component
      remoteFetches - the value for the remoteFetches record component
      totalOps - the value for the totalOps record component
      avgLatencyMs - the value for the avgLatencyMs record component
  • Method Details

    • hitRatePercent

      public double hitRatePercent()
      Returns the local cache hit rate as a percentage (0.0 to 100.0).
    • 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 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.
    • localCacheHits

      public long localCacheHits()
      Returns the value of the localCacheHits record component.
      Returns:
      the value of the localCacheHits record component
    • remoteFetches

      public long remoteFetches()
      Returns the value of the remoteFetches record component.
      Returns:
      the value of the remoteFetches record component
    • totalOps

      public long totalOps()
      Returns the value of the totalOps record component.
      Returns:
      the value of the totalOps record component
    • avgLatencyMs

      public double avgLatencyMs()
      Returns the value of the avgLatencyMs record component.
      Returns:
      the value of the avgLatencyMs record component