1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00
Files
go-mixed/cache/stats.go
2023-08-25 15:31:00 +08:00

21 lines
279 B
Go

package cache
import "sync/atomic"
type Stats struct {
Hits uint64
Misses uint64
}
func (s *Stats) IncrementHits() {
atomic.AddUint64(&s.Hits, 1)
}
func (s *Stats) IncrementMisses() {
atomic.AddUint64(&s.Misses, 1)
}
func (c *Cache) Stats() *Stats {
return c.stats
}