I'm showing the name of the currently logged-in user in header, using
\Drupal::currentUser()->getUsername(), but it's showing an already cached page. I know I can disable the cache for a particular page using
\Drupal::service('page_cache_kill_switch')->trigger(), but this won't work with the header.html.twig file.
How can I achieve it without affecting the performance?