- 🇬🇧United Kingdom endrukk
To extend on the original answer: depending on what's in your site settings you'd want to invalidate the following caches:
- cache.bootstrap
- cache.config
- cache.data
- cache.default
- cache.discovery
- cache.entity
- cache.menu
- cache.render
- cache.static
For example:
\Drupal::service('cache.config')->invalidateAll();
Additionally
\Drupal::service('router.builder')->rebuild()
might be also necessary.