1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 08:32:40 +08:00
This commit is contained in:
2022-11-18 16:57:23 +08:00
parent 278c8b4cb7
commit ea846a321a
5 changed files with 174 additions and 0 deletions

20
cache/stats.go vendored Normal file
View File

@ -0,0 +1,20 @@
package cache
import "sync/atomic"
type Stats struct {
Hits uint64
Misses uint64
}
func (s *Stats) AddHits() {
atomic.AddUint64(&s.Hits, 1)
}
func (s *Stats) AddMisses() {
atomic.AddUint64(&s.Misses, 1)
}
func (c *Cache) Stats() *Stats {
return c.stats
}