MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / updateEvictionStats

Method updateEvictionStats

db/channel_cache.go:558–573  ·  view source on GitHub ↗

Updates cache stats

(inactiveEvicted int, totalEvicted int, startTime time.Time)

Source from the content-addressed store, hash-verified

556
557// Updates cache stats
558func (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}

Callers 1

compactChannelCacheMethod · 0.95

Calls 2

AddMethod · 0.45
SinceMethod · 0.45

Tested by

no test coverage detected