ping method

Future<Map<String, dynamic>> ping()

Pings all open Redis connections to check their health.

Implementation

Future<Map<String, dynamic>> ping() async {
  return _openLock.synchronized(() async {
    final results = <String, dynamic>{};

    for (final cache in _caches.values) {
      try {
        final r = await cache.ping();

        results[cache.type.toString()] = {
          'reachable': r,
          'idx': cache.dbIdx,
        };
      } catch (e) {
        results[cache.type.toString()] = {
          'reachable': false,
        };
      }
    }

    return results;
  });
}