Updates cache stats
(inactiveEvicted int, totalEvicted int, startTime time.Time)
| 556 | |
| 557 | // Updates cache stats |
| 558 | func (c *channelCacheImpl) updateEvictionStats(inactiveEvicted int, totalEvicted int, startTime time.Time) { |
| 559 | // Eviction stats |
| 560 | if inactiveEvicted > 0 { |
| 561 | c.cacheStats.ChannelCacheChannelsEvictedInactive.Add(int64(inactiveEvicted)) |
| 562 | } |
| 563 | nruEvicted := totalEvicted - inactiveEvicted |
| 564 | if nruEvicted > 0 { |
| 565 | c.cacheStats.ChannelCacheChannelsEvictedNRU.Add(int64(nruEvicted)) |
| 566 | } |
| 567 | |
| 568 | // Compaction time is updated on each iteration (to ensure stat is updated during long-running compact) |
| 569 | c.cacheStats.ChannelCacheCompactTime.Add(time.Since(startTime).Nanoseconds()) |
| 570 | |
| 571 | // Update channel count |
| 572 | c.cacheStats.ChannelCacheNumChannels.Add(-1 * int64(totalEvicted)) |
| 573 | } |
no test coverage detected