init method

  1. @override
Future<void> init()

Implementation

@override
Future<void> init() async {
  try {
    await _connection.connect(settings.host, settings.port);

    final Map<String, dynamic> credentials = {
      'service': 'cache',
      'message': 'redis is connected',
      'payload': {
        'host': settings.host,
        'port': settings.port,
        'password': settings.password != null
            ? '*' * settings.password!.length
            : 'NO PASSWORD',
      },
    };

    logger.trace(jsonEncode(credentials));
  } on SocketException catch (error) {
    logger.fatal(error);
    throw Exception('$name - ${error.message}');
  }
}