Cache hit rate (0.0–1.0). Returns 0.0 if no lookups yet.
(&self)
| 296 | |
| 297 | /// Cache hit rate (0.0–1.0). Returns 0.0 if no lookups yet. |
| 298 | pub fn hit_rate(&self) -> f64 { |
| 299 | let hits = self.hits.get(); |
| 300 | let total = hits + self.misses.get(); |
| 301 | if total == 0 { |
| 302 | 0.0 |
| 303 | } else { |
| 304 | hits as f64 / total as f64 |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | /// Total cached documents across all database shards. |
| 309 | pub fn len(&self) -> usize { |