CacheMetrics class final

A snapshot of cache statistics at a point in time.

Obtain via Cache.metrics for a one-shot snapshot, or listen to Cache.metricsStream for periodic updates.

Constructors

CacheMetrics({required int hits, required int misses, required int evictions, required int currentEntries, required int estimatedBytes, required DateTime since})
const

Properties

currentEntries int
Number of entries currently held in this cache.
final
estimatedBytes int
Estimated total size in bytes of all current entries. Returns 0 if no SizeEstimator was configured.
final
evictions int
Number of entries removed by the eviction policy (LRU, TTL sweep, memory pressure). Does not include manual Cache.remove calls.
final
hashCode int
The hash code for this object.
no setterinherited
hitRate double
Fraction of get calls that were hits: hits / (hits + misses). Returns 0.0 if no get calls have been made yet.
no setter
hits int
Number of Cache.get calls that returned a non-null, non-expired value.
final
misses int
Number of Cache.get calls that returned null (miss or hard expiry).
final
missRate double
Fraction of get calls that were misses: misses / (hits + misses).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
since DateTime
The point in time from which these stats were collected.
final

Methods

copyWith({int? hits, int? misses, int? evictions, int? currentEntries, int? estimatedBytes, DateTime? since}) CacheMetrics
Returns a copy of this metrics object with updated fields.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited