allegro / allegro/bigcache

[Question]can bigcache add func reset stats

Aperta
#315 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
8.2k
Fork
614
Merge medio
5g 12h
PR unite (30g)
1

Descrizione

I want to calculate the 10 second cache hit rate, but func Stats() get hit rate is from when cache is init.
can bigcache add func reset stats
for example
```
func (c *BigCache) ResetStats() {
for _, shard := range c.shards {
shard.resetStats()
}
}

func (s *cacheShard) resetStats() {
s.stats = Stats{}
}
```

of course, i can record last Stats and get new Stats after 10 seconds, then use it calc hit rate. but i think add reset stats func can make code more clear

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.