18
19
// NewMapCounter creates a mapCounter that also tracks the top K entries.
21
>
return &mapCounter{
22
>
m: make(map[string]int),
23
>
limit: limit,
24
>
}
25
>
}
26
28
>
c, _ := m.getPassWithOverflow(key, base, inc)
29
>
return c
30
>
}
31
33
>
if idx, ok := m.m[key]; ok {
34
prev := m.heap[idx].Count
35
count := max(base, prev+inc)