* Returns a new CacheStats representing the difference between this CacheStats * and another. Negative values are rounded up to zero. * * @param other - The statistics to subtract from this instance * @returns The difference between this instance and other
(other: CacheStats)
| 165 | * @returns The difference between this instance and other |
| 166 | */ |
| 167 | minus(other: CacheStats): CacheStats { |
| 168 | return CacheStats.of( |
| 169 | Math.max(0, this.hitCount - other.hitCount), |
| 170 | Math.max(0, this.missCount - other.missCount), |
| 171 | Math.max(0, this.loadSuccessCount - other.loadSuccessCount), |
| 172 | Math.max(0, this.loadFailureCount - other.loadFailureCount), |
| 173 | Math.max(0, this.totalLoadTime - other.totalLoadTime), |
| 174 | Math.max(0, this.evictionCount - other.evictionCount) |
| 175 | ); |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * Returns a new CacheStats representing the sum of this CacheStats and another. |