Skip to content

[Question]can bigcache add func reset stats #315

@blacklensama

Description

@blacklensama

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions