Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]can bigcache add func reset stats #315

Open
blacklensama opened this issue Apr 18, 2022 · 0 comments
Open

[Question]can bigcache add func reset stats #315

blacklensama opened this issue Apr 18, 2022 · 0 comments

Comments

@blacklensama
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant