getCacheMetrics method

Future<PreparedStatementMetrics?> getCacheMetrics()

Returns prepared statement cache metrics from the worker.

Implementation

Future<PreparedStatementMetrics?> getCacheMetrics() async {
  final r = await _sendRequest<CacheMetricsResponse>(
    GetCacheMetricsRequest(_nextRequestId()),
  );
  if (r.error != null) return null;
  return PreparedStatementMetrics(
    cacheSize: r.cacheSize,
    cacheMaxSize: r.cacheMaxSize,
    cacheHits: r.cacheHits,
    cacheMisses: r.cacheMisses,
    totalPrepares: r.totalPrepares,
    totalExecutions: r.totalExecutions,
    memoryUsageBytes: r.memoryUsageBytes,
    avgExecutionsPerStmt: r.avgExecutionsPerStmt,
  );
}