DBInfo.fromString constructor

DBInfo.fromString(
  1. String str
)

Implementation

factory DBInfo.fromString(String str) {
  final parts = str.split(',');
  final info = <String, int>{};
  for (var part in parts) {
    final kv = part.split('=');
    info[kv[0]] = int.parse(kv[1]);
  }
  return DBInfo(
    keys: info['keys'] ?? 0,
    expires: info['expires'] ?? 0,
    avgTtl: info['avg_ttl'] ?? 0,
  );
}