-
Notifications
You must be signed in to change notification settings - Fork 39
Metrics
Alex Peck edited this page Nov 25, 2023
·
7 revisions
Metrics are disabled by default for ConcurrentLru. By calling the builder method WithMetrics you can turn on metrics.
ICache<int, int> lru = new ConcurrentLruBuilder<int, int>()
.WithMetrics()
.Build();For ConcurrentLfu metrics are always enabled since the buffered reads and writes mitigate any performance penalty.
To retrieve metrics from the cache, use the Metrics property.
long hits = lru.Metrics.Value.Hits;- Hit count
- Miss count
- Hit ratio
- Eviction count
- Update count
Internally metrics are implemented using the BitFaster.Caching.Counters.Counter class, a .NET implementation of Java's LongAdder. This is a scalable counter class that supports very high concurrent throughput.