MCPcopy
hub / github.com/redis/node-redis / minus

Method minus

packages/client/lib/client/cache.ts:167–176  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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.

Callers 1

cache.spec.tsFile · 0.80

Calls 1

ofMethod · 0.80

Tested by

no test coverage detected