private UsageRecord PingUpdate(uint key, UsageRecord oldValue) { var now = clock.GetMinutes(); // Saturating addition var oldFrequency = oldValue.GetCurrentFrequency(now, halfLifeMinutes); oldValue.frequency = Math.Max(oldFrequency + 1, oldFrequency); oldValue.lastRead = now; return(oldValue); }
internal UsageRecord(IClock clock) { lastRead = clock.GetMinutes(); frequency = 1; }