cacheStatistics property
Returns cache statistics for monitoring and tuning.
Returns a map containing:
size: Current number of cached entries (both configs)maxSize: Maximum cache capacity (both configs)utilization: Cache utilization (0.0 to 1.0)
Example:
final stats = SmoothMarkdown.cacheStatistics;
print('Cache usage: ${stats['utilization'] * 100}%');
Implementation
static Map<String, dynamic> get cacheStatistics {
final base = _parseCache.statistics;
final html = _htmlParseCache.statistics;
final size = (base['size'] as int) + (html['size'] as int);
final maxSize = (base['maxSize'] as int) + (html['maxSize'] as int);
return {
'size': size,
'maxSize': maxSize,
'utilization': maxSize == 0 ? 0.0 : size / maxSize,
};
}