()
| 406 | } |
| 407 | |
| 408 | func (c *cache) stats() CacheStats { |
| 409 | c.mu.RLock() |
| 410 | defer c.mu.RUnlock() |
| 411 | return CacheStats{ |
| 412 | Bytes: c.nbytes, |
| 413 | Items: c.itemsLocked(), |
| 414 | Gets: c.nget, |
| 415 | Hits: c.nhit, |
| 416 | Evictions: c.nevict, |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | func (c *cache) add(key string, value ByteView) { |
| 421 | c.mu.Lock() |